Expand README with setup guide and DevContainer comparison

Add comprehensive prerequisites section with detailed authentication steps.
Include comparison table showing differences from Anthropic's DevContainer.
Enhance documentation structure with better formatting and examples.
Add attribution section crediting dependencies and inspirations.

πŸ€– Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude 2025-06-18 12:07:36 +00:00
parent ab21920ad2
commit 7b50165881

159
README.md
View File

@ -6,67 +6,114 @@ A Docker container setup for running Claude Code with full autonomous permission
- Runs Claude Code in an isolated Docker container with full autonomy - Runs Claude Code in an isolated Docker container with full autonomy
- Integrates Twilio MCP for SMS notifications when tasks complete - Integrates Twilio MCP for SMS notifications when tasks complete
- Provides persistent context across sessions via scratchpad files - Provides persistent context across sessions
- Auto-configures Claude settings for seamless operation - Auto-configures Claude settings for seamless operation
- Simple one-command setup and usage - Simple one-command setup and usage
## Prerequisites ## Prerequisites
**Important**: Before building the Docker image, you must authenticate Claude Code on your host system: ⚠️ **IMPORTANT**: Complete these steps BEFORE using claude-docker:
1. Install Claude Code: `npm install -g @anthropic-ai/claude-code`
2. Run `claude` and complete the authentication flow
3. Verify authentication files exist: `ls ~/.claude.json ~/.claude/`
The Docker build will copy your authentication from these locations. ### 1. Claude Code Authentication (Required)
You must authenticate Claude Code on your host system first:
```bash
# Install Claude Code globally
npm install -g @anthropic-ai/claude-code
# Run and complete authentication
claude
# Verify authentication files exist
ls ~/.claude.json ~/.claude/
```
πŸ“– **Full Claude Code Setup Guide**: https://docs.anthropic.com/en/docs/claude-code
### 2. Docker Installation (Required)
- **Docker Desktop**: https://docs.docker.com/get-docker/
- Ensure Docker daemon is running before proceeding
### 3. Twilio Account (Optional - for SMS notifications)
If you want SMS notifications when tasks complete:
- Create free trial account: https://www.twilio.com/docs/usage/tutorials/how-to-use-your-free-trial-account
- Get your Account SID and Auth Token from the Twilio Console
- Get a phone number for sending SMS
### Why Pre-authentication?
The Docker container needs your existing Claude authentication to function. This approach:
- βœ… Uses your existing Claude subscription/API access
- βœ… Maintains secure credential handling
- βœ… Enables persistent authentication across container restarts
## Quick Start ## Quick Start
1. **Clone the repository:** ```bash
```bash # 1. Clone and enter directory
git clone https://github.com/VishalJ99/claude-docker.git git clone https://github.com/VishalJ99/claude-docker.git
cd claude-docker cd claude-docker
```
2. **Configure your API keys:** # 2. Setup environment
```bash cp .env.example .env
# Copy the example file nano .env # Add your API keys (see below)
cp .env.example .env
# Edit .env with your credentials # 3. Install
nano .env ./scripts/install.sh
```
Add your credentials to the `.env` file: # 4. Run from any project
```bash cd ~/your-project
ANTHROPIC_API_KEY=your_anthropic_key claude-docker
```
# For Twilio MCP integration (optional): ### Environment Variables (.env)
TWILIO_ACCOUNT_SID=your_twilio_sid ```bash
TWILIO_AUTH_TOKEN=your_twilio_auth_token # Required
TWILIO_FROM_NUMBER=your_twilio_number ANTHROPIC_API_KEY=your_anthropic_key
TWILIO_TO_NUMBER=your_phone_number
```
> **Important**: The `.env` file will be baked into the Docker image during build. This means: # Optional - SMS notifications
> - Your credentials are embedded in the image TWILIO_ACCOUNT_SID=your_twilio_sid
> - You can use the image from any directory without needing the .env file TWILIO_AUTH_TOKEN=your_twilio_auth_token
> - Keep your image secure since it contains your credentials TWILIO_FROM_NUMBER=+1234567890
TWILIO_TO_NUMBER=+0987654321
> **Note**: Twilio MCP uses Account SID and Auth Token. You can find these in your Twilio Console. # Optional - Custom conda paths
CONDA_PREFIX=/path/to/your/conda
CONDA_EXTRA_DIRS="/path/to/envs /path/to/pkgs"
3. **Build and install:** # Optional - System packages
```bash SYSTEM_PACKAGES="libopenslide0 libgdal-dev"
./scripts/install.sh ```
```
This will: ⚠️ **Security Note**: Credentials are baked into the Docker image. Keep your image secure!
- Build the Docker image with your credentials baked in
- Install the `claude-docker` command to your PATH
4. **Use from any project directory:** ## How This Differs from Anthropic's DevContainer
```bash
claude-docker We provide a different approach than [Anthropic's official .devcontainer](https://github.com/anthropics/claude-code/tree/main/.devcontainer):
```
| Feature | claude-docker | Anthropic's DevContainer |
|---------|--------------|-------------------------|
| **IDE Integration** | Standalone - works with any editor | VSCode-specific |
| **Authentication** | Persistent across all projects | Per-devcontainer |
| **Security Model** | Full autonomy (dangerously-skip-permissions) | Restrictive firewall whitelist |
| **Network Access** | Unrestricted | Limited to specific domains |
| **Conda Support** | Full integration with custom paths | Standard Node.js environment |
| **SMS Notifications** | Built-in Twilio MCP | Not included |
| **Setup Complexity** | One-time install, works everywhere | Per-project configuration |
| **Use Case** | Autonomous task execution | Secure development environment |
### When to Use Each
**Use claude-docker when you want:**
- πŸš€ Maximum autonomy and flexibility
- πŸ“± SMS notifications for long-running tasks
- 🐍 Integration with existing conda environments
- πŸ”§ Quick setup without per-project configuration
- πŸ’» Editor/IDE independence
**Use Anthropic's DevContainer when you want:**
- πŸ”’ Maximum security with network restrictions
- πŸ†š Deep VSCode integration
- πŸ›‘οΈ Controlled environment with explicit whitelisting
- πŸ‘₯ Team-standardized development environments
## Usage Patterns ## Usage Patterns
@ -120,7 +167,7 @@ This workflow gives you:
- Works with environments and package caches in non-standard locations - Works with environments and package caches in non-standard locations
### πŸ—‚οΈ Context Persistence ### πŸ—‚οΈ Context Persistence
- Maintains scratchpad.md files for project memory - Maintains project-specific Claude configuration
- Persistent across container sessions - Persistent across container sessions
- Helps Claude remember project context - Helps Claude remember project context
@ -148,12 +195,14 @@ This workflow gives you:
``` ```
claude-docker/ claude-docker/
β”œβ”€β”€ Dockerfile # Main container definition β”œβ”€β”€ Dockerfile # Main container definition
β”œβ”€β”€ .env.example # Template for environment variables
β”œβ”€β”€ scripts/ β”œβ”€β”€ scripts/
β”‚ β”œβ”€β”€ claude-docker.sh # Wrapper script for container β”‚ β”œβ”€β”€ claude-docker.sh # Wrapper script for container
β”‚ β”œβ”€β”€ install.sh # Installation script β”‚ β”œβ”€β”€ install.sh # Installation script
β”‚ └── startup.sh # Container startup script β”‚ └── startup.sh # Container startup script
└── templates/ └── templates/
└── scratchpad.md # Template for project context └── .claude/
└── CLAUDE.md # Claude behavior instructions
``` ```
## Configuration ## Configuration
@ -170,7 +219,6 @@ The setup creates `~/.claude-docker/` in your home directory with:
Each project gets: Each project gets:
- `.claude/settings.json` - Claude Code settings with MCP - `.claude/settings.json` - Claude Code settings with MCP
- `.claude/CLAUDE.md` - Instructions for Claude behavior - `.claude/CLAUDE.md` - Instructions for Claude behavior
- `scratchpad.md` - Project context file
### Rebuilding the Image ### Rebuilding the Image
@ -244,6 +292,21 @@ SYSTEM_PACKAGES="libopenslide0 libgdal-dev libproj-dev libopencv-dev"
- Shell history persistence between sessions - Shell history persistence between sessions
- Additional security features - Additional security features
## Repository ## Attribution & Dependencies
https://github.com/VishalJ99/claude-docker ### Core Dependencies
- **Claude Code**: Anthropic's official CLI - https://github.com/anthropics/claude-code
- **Twilio MCP Server**: SMS integration by @yiyang.1i - https://github.com/yiyang1i/sms-mcp-server
- **Docker**: Container runtime - https://www.docker.com/
### Inspiration & References
- Anthropic's DevContainer implementation: https://github.com/anthropics/claude-code/tree/main/.devcontainer
- MCP (Model Context Protocol): https://modelcontextprotocol.io/
### Created By
- **Repository**: https://github.com/VishalJ99/claude-docker
- **Author**: Vishal J (@VishalJ99)
## License
This project is open source. See the LICENSE file for details.