Docker Sandboxes
Docker Sandboxes simplifies running AI agents securely on your local machine. Designed for developers building with coding agents like Claude Code, Sandboxes isolate your agents from your local machine while preserving a familiar development experience. With Docker Sandboxes, agents can execute commands, install packages, and modify files inside a containerized workspace that mirrors your local directory. This gives you full agent autonomy without compromising safety.
How it works
When you run docker sandbox run <agent>:
Docker creates a container from a template image and mounts your current working directory into the container at the same path.
Docker discovers your Git
user.nameanduser.emailconfiguration and injects it into the container so commits made by the agent are attributed to you.On first run, you're prompted to authenticate. Credentials are stored in a Docker volume and reused for future sandboxed agents.
The agent starts inside the container with bypass permissions enabled.
Workspace mounting
Your workspace directory is mounted into the container at the same absolute path
(on macOS and Linux). For example, /Users/alice/projects/myapp on your host
is also /Users/alice/projects/myapp in the container. This means:
- File paths in error messages match your host
- Scripts with hard-coded paths work as expected
- Changes to workspace files are immediately visible on both host and container
One sandbox per workspace
Docker enforces one sandbox per workspace. When you run docker sandbox run <agent> in the same directory, Docker reuses the existing container. This
means state (installed packages, temporary files) persists across agent sessions
in that workspace.
メモTo change a sandbox's configuration (environment variables, mounted volumes, etc.), you need to remove and recreate it. See Managing sandboxes for details.
Release status
Docker Sandboxes is an experimental feature. Features and setup are subject to change.
Report issues on GitHub:
Get started
Head to the Get started guide to run your first sandboxed agent.