Docker image for Claude Code with plugins and companion tooling pre-installed. Ready to deploy via D
10K+
A self-hosted Docker Compose environment for Claude Code. Runs on a home-lab VM and stays accessible from any LAN device via a single-command tmux attach — no third-party session management required.
Pre-installed: Claude Code, Caveman.
Clone the repo onto the host VM:
git clone <repo-url> claude-code-env
cd claude-code-env
Copy the example env file, fill in your values, and lock down permissions:
cp .env.example .env
# Edit .env: set WORKSPACE_PATH, and optionally ANTHROPIC_API_KEY and USER_ID/GROUP_ID
# Run `id -u` and `id -g` on the host to find your UID/GID (default: 1000/1000)
chmod 600 .env
Make the attach script executable:
chmod +x scripts/attach.sh
Start the container (pulls the image automatically on first run):
docker compose up -d
Attach to the session:
./scripts/attach.sh
Detach at any time with Ctrl-b d. The session keeps running.
(First time only) Inside the container, authenticate Claude Code:
/login
Follow the prompts to complete authentication via claude.ai OAuth, or set ANTHROPIC_API_KEY in .env to skip interactive login.
(Optional) Install additional Claude Code plugins or skills from inside the session. They persist in the ~/.claude bind mount across restarts.
From any device SSH'd to the host:
./scripts/attach.sh
Multiple devices can attach to the same session simultaneously — you see the same terminal view on all of them. Detach with Ctrl-b d.
If the session exited (e.g. after a Claude Code crash), it is automatically recreated within 30 seconds. Just re-run attach.sh.
~/.claude may contain sensitive auth/session data. Treat backups as secrets:
All persistent state lives in ~/.claude/ on the host (bind-mounted into the container). Back it up with any standard method:
tar czf claude-backup-$(date +%Y%m%d).tar.gz -C ~ .claude
tar xzf claude-backup-<date>.tar.gz -C ~
To move the environment to a new VM:
~/.claude/ (see above)..env file to the new host (keep .env secure; it may contain your API key).tar xzf claude-backup-<date>.tar.gz -C ~
docker compose up -d
./scripts/attach.sh
All Claude Code settings, memory, and Caveman configuration are restored. No manual reconfiguration needed.
| Variable | Required | Default | Description |
|---|---|---|---|
ANTHROPIC_API_KEY | No | — | Anthropic API key. Optional if you use interactive /login inside the container |
WORKSPACE_PATH | Yes | — | Absolute host path mounted as /workspace inside the container |
USER_ID | No | 1000 | UID for the container user. Match your host UID (id -u) for correct file ownership on the workspace mount |
GROUP_ID | No | 1000 | GID for the container user. Match your host GID (id -g) |
claude) with the UID/GID you specify. Workspace files must be owned by that UID for write access inside the container.~/.claude/ is seeded from image defaults on first start (no settings.json present) and never overwrites existing user data.~/.claude/settings.json is shared between the host and container. If your host settings contain host-specific paths (hook commands, status line scripts), those paths will not resolve inside the container. The container and host cannot share identical settings.json without path conflicts.Content type
Image
Digest
sha256:55f16c363…
Size
211.5 MB
Last updated
2 months ago
docker pull taegost/claude-code-env