I’ve been running Claude Code in Docker instead of directly on my machine and wanted to share the setup in case it helps others who want a bit of isolation without changing their workflow. The idea: pull a pre-built image, mount your repo + existing ~/.claude login, add one shell alias. Claude Code runs inside the container, your project is bind-mounted so edits land on your real disk. Docker is the outer boundary. Inside the container I use –dangerously-skip-permissions so Claude can run builds, tests, npm, etc. without stopping on every permission prompt. You still review diffs before committing — this isn’t “trust the agent blindly.” Quick start Install Docker Sign in to Claude Code on your host once (so ~/.claude exists) Add to ~/.zshrc or ~/.bashrc :
alias claude='claude-code' ```
Reload and run from any project:
bash source ~/.zshrc cd ~/my-app && claude-code
First run pulls the image. No repo clone required.
What's in the
claude-code
image
Claude Code CLI (official install script)
Node, Python, Go, Rust on the
full
tag
Playwright + Chromium on the full tag (browser/testing workflows)
Multi-arch:
amd64
+
arm64
Smaller variants if you don't need everything:
claude-node
,
claude-python
,
claude-go
,
claude-rust
.
Optional extras
Git/SSH (read-only from host):
bash -v "$HOME/.gitconfig:/root/.gitconfig:ro" \ -v "$HOME/.ssh:/root/.ssh:ro"
API key instead of subscription login:
```bash -e ANTHROPIC_API_KEY
or
-e CLAUDE_CODE_OAUTH_TOKEN ```
On macOS with Docker Desktop, add
:cached
to volume mounts if file sync feels slow.
What this does / doesn't do
Does:
keep Claude Code's shell commands off your host OS, reuse your existing Claude Pro/Max subscription auth from
~/.claude
Doesn't:
hide your project — the repo is mounted and writable by design
Doesn't:
replace code review, still read what it changed before you push
Links
GitHub:
https://github.com/sayem314/ai-agents
Docker Hub:
https://hub.docker.com/r/sayem314/ai-agents
Claude Code specific docs:
https://github.com/sayem314/ai-agents/blob/main/docs/claude-code.md
Same repo also has Docker wrappers for Codex and OpenCode if you use those.
submitted by
/u/74Y3M
Originally posted by u/74Y3M on r/ClaudeCode
