
A vanilla Claude Code Docker image with security hardening. No plugins, no opinionated defaults — just Claude Code in a locked-down container. You bring your own workspace, settings, and plugins via volume mounts.
Image: jehoshua02/claude-code on DockerHub
debian:bookworm-slim basegit, curl, bash, openssh-client, ca-certificatesclaude user (uid 1000)known_hosts for GitHub, GitLab, BitbucketTwo options:
Option A: API key — set ANTHROPIC_API_KEY as an environment variable.
Option B: OAuth (Pro/Max subscription) — mount your host's ~/.claude to /home/claude/.claude and your existing credentials just work. Or mount any directory there and run claude auth login inside the container on first run.
With API key:
bashdocker run --rm -it \ -e ANTHROPIC_API_KEY=sk-ant-... \ -v ./workspace:/workspace \ -v ~/.claude:/home/claude/.claude \ jehoshua02/claude-code:latest
With OAuth (using host's ~/.claude):
bashdocker run --rm -it \ -v ./workspace:/workspace \ -v ~/.claude:/home/claude/.claude \ jehoshua02/claude-code:latest
bashdocker run --rm -it \ -e GIT_USER_NAME="Your Name" \ -e GIT_USER_EMAIL="you@example.com" \ -v ./workspace:/workspace \ -v ~/.claude:/home/claude/.claude \ --cap-drop ALL \ --security-opt no-new-privileges \ --read-only \ --tmpfs /tmp:uid=1000,gid=1000 \ --tmpfs /home/claude/.ssh:uid=1000,gid=1000 \ --memory 4g \ --cpus 2 \ jehoshua02/claude-code:latest
Add -e ANTHROPIC_API_KEY=sk-ant-... if using an API key, or ensure OAuth credentials exist in the mounted volume.
| Flag | Purpose |
|---|---|
--cap-drop ALL | Drop all Linux capabilities. Claude doesn't need any. |
--security-opt no-new-privileges | Block privilege escalation via setuid/setgid. |
--read-only | Root filesystem is read-only. Writes only to volumes and tmpfs. |
--tmpfs /tmp:uid=1000,gid=1000 | Writable scratch space (lost on container stop). |
--tmpfs /home/claude/.ssh:uid=1000,gid=1000 | Entrypoint writes SSH config here at startup. |
--memory 4g | Cap memory usage. Adjust to your needs. |
--cpus 2 | Cap CPU usage. Adjust to your needs. |
See compose.example.yml for a fully commented reference. Copy and adapt:
bashcp compose.example.yml compose.yml # edit compose.yml docker compose run --rm claude
| Container path | Purpose | Example host path |
|---|---|---|
/workspace | Your project files. Claude reads and writes here. | ~/projects/my-app |
/home/claude/.claude | Persisted state: settings, history, plugins, OAuth tokens. | ~/.claude |
| Variable | Required | Purpose |
|---|---|---|
ANTHROPIC_API_KEY | Yes (unless OAuth) | API key for Claude. |
GIT_USER_NAME | No | Git author name for commits. |
GIT_USER_EMAIL | No | Git author email for commits. |
If Claude needs SSH access (e.g. private git repos), provide your key as a Docker secret. This is the most secure method — the key is never baked into image layers or visible in docker inspect.
With Docker Compose (see compose.example.yml):
yamlsecrets: ssh_private_key: file: ./ssh_key
With docker run:
bashdocker run --rm -it \ ... \ --secret id=ssh_private_key,src=./ssh_key \ jehoshua02/claude-code:latest
Note: --secret requires BuildKit or Swarm mode. For simple setups, you can bind-mount the key directly:
bash-v ~/.ssh/id_rsa:/run/secrets/ssh_private_key:ro
The entrypoint checks /run/secrets/ssh_private_key at startup and copies it into ~/.ssh/id_rsa with locked-down permissions.
This image ships with no plugins and no default settings. Mount a directory to /home/claude/.claude (e.g. your host's ~/.claude) and:
claude plugin install <name>All arguments are forwarded to the claude CLI:
bash# One-shot prompt docker run --rm \ -e ANTHROPIC_API_KEY=sk-ant-... \ -v ./workspace:/workspace \ jehoshua02/claude-code:latest \ -p "Review the code and suggest improvements" # With specific allowed tools docker run --rm -it \ ... \ jehoshua02/claude-code:latest \ --allowedTools "Read,Write,Bash"
jehoshua02/claude-codebash./build.sh 1.0.0
Builds and tags:
jehoshua02/claude-code:1.0.0jehoshua02/claude-code:latestbashdocker login ./build.sh 1.0.0 --push
After a successful push, tag the commit:
bashgit tag v1.0.0 git push origin v1.0.0
Semver. Bump when:
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。




探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
docker search 限制
站内搜不到镜像
离线 save/load
插件要用 plugin install
WSL 拉取慢
安全与 digest
新手拉取配置
镜像合规机制
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
域名连通性排查
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务