This setup allows you to run Claude Code in an isolated Docker container with proper permissions and workspace access.
- Docker and Docker Compose installed
- Git (recommended for version control)
-
Make the setup script executable:
chmod +x cli/claude-code.sh
-
Run the setup script:
./cli/claude-code.sh
-
Complete authentication:
- Run
claudein the container - Follow the authentication prompts in your browser
- Complete the OAuth flow
- Run
-
Start the container (if not already running):
docker-compose -f docker-compose.claude-code.yml up -d
-
Start an interactive shell:
docker-compose -f docker-compose.claude-code.yml exec -u node claude-code /bin/bash -
Run Claude Code:
claude
-
Your local
./workspacedirectory is mounted at/workspacein the container -
Navigate to your project directory:
cd /workspace/your-project -
Initialize a new project (if needed):
claude > /init
Claude Code supports multiple authentication methods:
-
Anthropic Console (default):
- Requires active billing at console.anthropic.com
- Complete OAuth flow in browser
-
Claude App (Pro or Max plan):
- Use your Claude.ai account
- Select the appropriate plan during authentication
-
Enterprise platforms:
- Configure for Amazon Bedrock or Google Vertex AI
- Set up using environment variables in
docker-compose.claude-code.yml
If you encounter permission errors:
-
Ensure the
workspacedirectory is writable:chmod -R 755 workspace
-
Check container logs:
docker-compose -f docker-compose.claude-code.yml logs
To verify the Node.js version in the container:
docker-compose -f docker-compose.claude-code.yml exec -u node claude-code node --versionTo stop the container:
docker-compose -f docker-compose.claude-code.yml down- The container runs as a non-root user
- Only the
workspacedirectory is mounted - NPM cache and config are stored in Docker volumes
- No sudo access inside the container