Warning
- This work is alpha and might have security issues, use at your own risk.
- Check TODO.md for the roadmap.
- Email [email protected] for inquiries.
Run Claude Code as an autonomous agent inside Docker containers with automatic GitHub integration. Bypass all permissions safely.

The primary goal of Claude Code Sandbox is to enable full async agentic workflows by allowing Claude Code to execute without permission prompts. By running Claude in an isolated Docker container with the --dangerously-skip-permissions flag, Claude can:
- Execute any command instantly without asking for permission
- Make code changes autonomously
- Run build tools, tests, and development servers
- Create commits and manage git operations
- Work continuously without interrupting the user
Access Claude through a browser-based terminal that lets you monitor and interact with the AI assistant while you work on other tasks. This creates a truly autonomous development assistant, similar to OpenAI Codex or Google Jules, but running locally on your machine with full control.
Claude Code Sandbox allows you to run Claude Code in isolated Docker containers, providing a safe environment for AI-assisted development. It automatically:
- Creates a new git branch for each session
- Monitors for commits made by Claude
- Provides interactive review of changes
- Handles credential forwarding securely
- Enables push/PR creation workflows
- Runs custom setup commands for environment initialization
Claude Code Sandbox must be built from source:
- Node.js >= 18.0.0
- Docker
- Git
- Claude Code (npm install -g @anthropic-ai/claude-code@latest)
Simply run in any git repository:
This will:
- Create a new branch (claude/[timestamp])
- Start a Docker container with Claude Code
- Launch a web UI at http://localhost:3456
- Open your browser automatically
Start a new container with web UI (recommended):
Explicitly start a new container with options:
Attach to an existing container:
List all Claude Sandbox containers:
Stop containers:
View container logs:
Remove stopped containers:
Show current configuration:
Create a claude-sandbox.config.json file (see claude-sandbox.config.example.json for reference):
- dockerImage: Base Docker image to use (default: claude-code-sandbox:latest)
- dockerfile: Path to custom Dockerfile (optional)
- detached: Run container in detached mode
- autoPush: Automatically push branches after commits
- autoCreatePR: Automatically create pull requests
- autoStartClaude: Start Claude Code automatically (default: true)
- envFile: Load environment variables from file (e.g., .env)
- environment: Additional environment variables
- setupCommands: Commands to run after container starts (e.g., install dependencies)
- volumes: Legacy volume mounts (string format)
- mounts: Modern mount configuration (object format)
- allowedTools: Claude tool permissions (default: all)
- maxThinkingTokens: Maximum thinking tokens for Claude
- bashTimeout: Timeout for bash commands in milliseconds
- containerPrefix: Custom prefix for container names
- claudeConfigPath: Path to Claude configuration file
The mounts array allows you to mount files or directories into the container:
- source: Path on the host (relative paths are resolved from current directory)
- target: Path in the container (relative paths are resolved from /workspace)
- readonly: Optional boolean to make the mount read-only (default: false)
Example use cases:
- Mount data directories that shouldn't be in git
- Share configuration files between host and container
- Mount build artifacts or dependencies
- Access host system resources (use with caution)
Launch a browser-based terminal interface to interact with Claude Code:
This will:
- Start the container in detached mode
- Launch a web server on http://localhost:3456
- Open your browser automatically
- Provide a full terminal interface with:
- Real-time terminal streaming
- Copy/paste support
- Terminal resizing
- Reconnection capabilities
Perfect for when you want to monitor Claude's work while doing other tasks.
Claude Code Sandbox automatically discovers and forwards:
Claude Credentials:
- Anthropic API keys (ANTHROPIC_API_KEY)
- macOS Keychain credentials (Claude Code)
- AWS Bedrock credentials
- Google Vertex credentials
- Claude configuration files (.claude.json, .claude/)
GitHub Credentials:
- GitHub CLI authentication (gh auth)
- GitHub tokens (GITHUB_TOKEN, GH_TOKEN)
- Git configuration (.gitconfig)
- Claude runs with --dangerously-skip-permissions flag (safe in container)
- Creates isolated branch for each session
- Full access to run any command within the container
- Files are copied into container (not mounted) for true isolation
- Git history preserved for proper version control
When Claude makes a commit:
- Real-time notification appears
- Full diff is displayed with syntax highlighting
- Interactive menu offers options:
- Continue working
- Push branch to remote
- Push branch and create PR
- Exit
Run multiple Claude instances simultaneously:
The default Docker image includes:
- Ubuntu 22.04
- Git, GitHub CLI
- Node.js, npm
- Python 3
- Claude Code (latest)
- Build essentials
Create a custom environment:
Reference in config:
-
Start Claude Sandbox:
cd my-project claude-sandbox -
Interact with Claude:
> Help me refactor the authentication module to use JWT tokens -
Claude works autonomously:
- Explores codebase
- Makes changes
- Runs tests
- Commits changes
-
Review and push:
- See commit notification
- Review syntax-highlighted diff
- Choose to push and create PR
- Credentials are mounted read-only
- Containers are isolated from host
- Branch restrictions prevent accidental main branch modifications
- All changes require explicit user approval before pushing
Ensure Claude Code is installed globally:
Add your user to the docker group:
Remove all Claude Sandbox containers and images:
Set credentials explicitly:
Or use an .env file with envFile config option.
Ensure you're using Node.js >= 18.0.0:
- npm run build - Build TypeScript to JavaScript
- npm run dev - Watch mode for development
- npm start - Run the CLI
- npm run lint - Run ESLint
- npm test - Run tests
- npm run purge-containers - Clean up all containers
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests: npm test
- Run linter: npm run lint
- Submit a pull request
MIT