ClaudeBox: Claude Code Docker Development Environment

4 months ago 8

Docker License GitHub

The Ultimate Claude Code Docker Development Environment - Run Claude AI's coding assistant in a fully containerized, reproducible environment with pre-configured development profiles and MCP servers.

██████╗██╗ █████╗ ██╗ ██╗██████╗ ███████╗ ██╔════╝██║ ██╔══██╗██║ ██║██╔══██╗██╔════╝ ██║ ██║ ███████║██║ ██║██║ ██║█████╗ ██║ ██║ ██╔══██║██║ ██║██║ ██║██╔══╝ ╚██████╗███████╗██║ ██║╚██████╔╝██████╔╝███████╗ ╚═════╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝ ██████╗ ██████╗ ██╗ ██╗ ██╔══██╗██╔═══██╗╚██╗██╔╝ ██████╔╝██║ ██║ ╚███╔╝ ██╔══██╗██║ ██║ ██╔██╗ ██████╔╝╚██████╔╝██╔╝ ██╗ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝

🚀 What's New in Latest Update

  • Per-Project Docker Images: Each project now maintains its own Docker image for complete isolation
  • Intelligent Layer Caching: Optimized Docker builds with profile-specific layer caching
  • Task Engine: Built-in compact task engine for reliable code generation (/taskengine)
  • Automatic Profile Rebuilding: Detects profile changes and rebuilds automatically
  • Enhanced Firewall Templates: Pre-configured allowlists for GitHub, GitLab, and Bitbucket
  • Project-Specific Claude Config: Each project can have its own .claude.json settings
  • Profile Dependencies: Smart dependency resolution (e.g., C profile includes build tools)
  • Containerized Environment: Run Claude Code in an isolated Docker container
  • Development Profiles: Pre-configured language stacks (C/C++, Python, Rust, Go, etc.)
  • Project Isolation: Complete separation of images, settings, and data between projects
  • Persistent Configuration: Settings and data persist between sessions
  • Multi-Instance Support: Work on multiple projects simultaneously
  • Package Management: Easy installation of additional development tools
  • Auto-Setup: Handles Docker installation and configuration automatically
  • Security Features: Network isolation with project-specific firewall allowlists
  • Developer Experience: GitHub CLI, Delta, fzf, and zsh with oh-my-zsh
  • Python Virtual Environments: Automatic per-project venv creation with uv
  • Cross-Platform: Works on Ubuntu, Debian, Fedora, Arch, and more
  • Linux or macOS (WSL2 for Windows)
  • Bash shell
  • Docker (will be installed automatically if missing)
# Download and setup ClaudeBox curl -O https://raw.githubusercontent.com/RchGrav/claudebox/main/claudebox chmod +x claudebox # Run initial setup (handles everything automatically) ./claudebox

The script will:

  • ✅ Check for Docker (install if needed)
  • ✅ Configure Docker for non-root usage
  • ✅ Build the ClaudeBox image with MCP servers
  • ✅ Create a global symlink for easy access
  • ✅ Set up MCP configuration in your workspace
# Launch Claude CLI with MCP servers enabled claudebox # Pass arguments to Claude claudebox --model opus -c # Get help claudebox --help # Shows Claude help with ClaudeBox additions

ClaudeBox supports running multiple instances in different projects simultaneously:

# Terminal 1 - Project A cd ~/projects/website claudebox # Terminal 2 - Project B cd ~/projects/api claudebox shell # Terminal 3 - Project C cd ~/projects/ml-model claudebox profile python ml

Each project maintains its own:

  • Docker image (claudebox-<project-name>)
  • Language profiles and installed packages
  • Firewall allowlist
  • Python virtual environment
  • Memory and context (via MCP)
  • Claude configuration (.claude.json)

ClaudeBox includes 15+ pre-configured development environments:

# List all available profiles claudebox profile # Install specific profiles (project-specific) claudebox profile python ml # Python + Machine Learning claudebox profile c openwrt # C/C++ + OpenWRT claudebox profile rust go # Rust + Go
  • c - C/C++ Development (gcc, g++, gdb, valgrind, cmake, cmocka, lcov, ncurses)
  • openwrt - OpenWRT Development (cross-compilation, QEMU, build essentials)
  • rust - Rust Development (cargo, rustc, clippy, rust-analyzer)
  • python - Python Development (pip, venv, black, mypy, pylint, poetry, pipenv)
  • go - Go Development (latest Go toolchain)
  • javascript - Node.js/TypeScript (npm, yarn, pnpm, TypeScript, ESLint, Prettier)
  • java - Java Development (OpenJDK 17, Maven, Gradle, Ant)
  • ruby - Ruby Development (Ruby, gems, bundler)
  • php - PHP Development (PHP, Composer, common extensions)
  • database - Database Tools (PostgreSQL, MySQL, SQLite, Redis, MongoDB clients)
  • devops - DevOps Tools (Docker, Kubernetes, Terraform, Ansible, AWS CLI)
  • web - Web Development (nginx, curl, httpie, jq)
  • embedded - Embedded Development (ARM toolchain, OpenOCD, PlatformIO)
  • datascience - Data Science (NumPy, Pandas, Jupyter, R)
  • security - Security Tools (nmap, tcpdump, wireshark, penetration testing)
  • ml - Machine Learning (PyTorch, TensorFlow, scikit-learn, transformers)

Save your preferred security flags to avoid typing them every time:

# Save default flags claudebox save --enable-sudo --disable-firewall # Clear saved flags claudebox save # Now all claudebox commands will use your saved flags automatically claudebox # Will run with sudo and firewall disabled

View detailed information about your ClaudeBox setup:

# Show all project profiles and running containers claudebox info # Example output: # ClaudeBox Profile Status # # Tracking 3 project profile(s) # # /home/user/project1: # Profiles: python ml # Packages: htop vim # # /home/user/project2: # Profiles: rust # # Current project (/home/user/project1): # Profiles: python ml # Packages: htop vim # # Running ClaudeBox containers: # CONTAINER ID STATUS COMMAND # abc123def Up 5 minutes claude # # ClaudeBox Docker Images: # REPOSITORY TAG SIZE # claudebox-project1 latest 2.1GB # claudebox-project2 latest 1.8GB
# Install additional packages (project-specific) claudebox install htop vim tmux # Open a shell in the container claudebox shell # Update Claude CLI claudebox update

ClaudeBox contains a compact task engine for reliable code generation tasks:

# In Claude, use the task command /task # This provides a systematic approach to: # - Breaking down complex tasks # - Implementing with quality checks # - Iterating until specifications are met
# Run with sudo enabled (use with caution) claudebox --enable-sudo # Disable network firewall (allows all network access) claudebox --disable-firewall # Skip permission checks claudebox --dangerously-skip-permissions
# View all clean options claudebox clean --help # Remove containers only claudebox clean # Remove current project's data and profile claudebox clean --project # Remove containers and image claudebox clean --image # Remove Docker build cache claudebox clean --cache # Remove associated volumes claudebox clean --volumes # Complete cleanup claudebox clean --all # Rebuild the image from scratch claudebox rebuild

ClaudeBox stores data in:

  • ~/.claude/ - Claude configuration and data
  • ~/.claudebox/ - Global ClaudeBox data
  • ~/.claudebox/profiles/ - Per-project profile configurations
  • ~/.claudebox/<project-name>/ - Project-specific data (memory, context, firewall, .claude.json)
  • Current directory mounted as /workspace in container

Project-Specific Features

Each project automatically gets:

  • Docker Image: claudebox-<project-name> with installed profiles
  • Profile Configuration: ~/.claudebox/profiles/<project-name>.ini
  • Python Virtual Environment: .venv created with uv when Python profile is active
  • Firewall Allowlist: Customizable per-project network access rules
  • Claude Configuration: Project-specific .claude.json settings
  • ANTHROPIC_API_KEY - Your Anthropic API key
  • NODE_ENV - Node environment (default: production)

ClaudeBox creates a per-project Debian-based Docker image with:

  • Node.js (via NVM for version flexibility)
  • Claude Code CLI (@anthropic-ai/claude-code)
  • User account matching host UID/GID
  • Network firewall (project-specific allowlists)
  • Volume mounts for workspace and configuration
  • GitHub CLI (gh) for repository operations
  • Delta for enhanced git diffs (version 0.17.0)
  • uv for fast Python package management
  • Nala for improved apt package management
  • fzf for fuzzy finding
  • zsh with oh-my-zsh
  • Profile-specific development tools with intelligent layer caching

Contributions are welcome! Please feel free to submit a Pull Request.

This project is licensed under the MIT License - see the LICENSE file for details.

ClaudeBox automatically handles Docker setup, but if you encounter issues:

  1. The script will add you to the docker group
  2. You may need to log out/in or run newgrp docker
  3. Run claudebox again

Profile Installation Failed

# Clean and rebuild for current project claudebox clean --project claudebox rebuild claudebox profile <name>

Profile Changes Not Taking Effect

ClaudeBox automatically detects profile changes and rebuilds when needed. If you're having issues:

# Force rebuild claudebox rebuild

Python Virtual Environment Issues

ClaudeBox automatically creates a venv when Python profile is active:

# The venv is created at ~/.claudebox/<project>/.venv # It's automatically activated in the container claudebox shell which python # Should show the venv python

Ensure the symlink was created:

ls -la ~/.local/bin/claudebox # Or manually create it ln -s /path/to/claudebox ~/.local/bin/claudebox

Multiple Instance Conflicts

Each project has its own Docker image and is fully isolated. To check status:

# Check all ClaudeBox images and containers claudebox info # Clean project-specific data claudebox clean --project

If builds are slow or failing:

# Clear Docker build cache claudebox clean --cache # Complete cleanup and rebuild claudebox clean --all claudebox
  • Anthropic for Claude AI
  • Model Context Protocol for MCP servers
  • Docker community for containerization tools
  • All the open-source projects included in the profiles

Made with ❤️ for developers who love clean, reproducible environments

Author/Maintainer: RchGrav
GitHub: @RchGrav

Read Entire Article