Prerequisites
Before deploying with Docker, ensure you have:- Docker installed and running
- Docker Compose (included with Docker Desktop)
- Authenticated with GitHub Copilot (run
node scripts/auth.mjsfirst) - Auth file exists at
~/.claude-copilot-auth.json
Quick start
The easiest way to start the Docker proxy:- Build the Docker image from the Dockerfile
- Start the container in detached mode
- Enable automatic restarts with
restart: always - Expose the proxy on port 18080
Docker Compose configuration
Thedocker-compose.yml defines the complete service configuration:
docker-compose.yml
Configuration breakdown
Build context:build: .- Builds image from Dockerfile in current directory- Uses the official
node:22-alpinebase image - Only copies the proxy script - minimal attack surface
claude-copilot-proxy- Fixed name for easy management- Allows commands like
docker logs claude-copilot-proxy
restart: always- Critical for production deployments- Container starts automatically when Docker daemon starts
- Survives system reboots
- Restarts if the proxy crashes
18080:18080- Maps host port 18080 to container port 18080- Change the first number to use a different host port
- Example:
8080:18080to expose on port 8080
- Mounts your auth file from
~/.claude-copilot-auth.jsonto/root/.claude-copilot-auth.json :roflag makes it read-only for security- The proxy reads the token on startup (scripts/proxy.mjs:416-432)
COPILOT_PROXY_PORT=18080- Port the proxy listens on inside the containerBRAVE_API_KEY- Optional Brave Search API key for web searchWEB_SEARCH_MAX_RESULTS- Maximum search results per query (default: 5)
Dockerfile
The Dockerfile creates a minimal container:Dockerfile
- Minimal image size (~50MB vs ~900MB for full Node.js)
- Faster builds and deployments
- Reduced attack surface
- The proxy has zero dependencies, so we only need Node.js runtime
Common deployment commands
Start the proxy
Start in detached mode (runs in background):Stop the proxy
Stop the container (can be restarted):Check status
View running containers:View logs
Follow logs in real-time:Using Claude Code with Docker proxy
Once the Docker container is running, launch Claude Code with:- Checks if proxy is already running
- Starts Docker container if needed
- Waits for proxy to be ready
- Launches Claude Code with correct environment variables
Environment variables
You can configure the Docker deployment with environment variables:Using a .env file
Create a.env file in the project root:
.env
Passing variables directly
Override variables when starting:Available variables
| Variable | Default | Description |
|---|---|---|
COPILOT_PROXY_PORT | 18080 | Port the proxy listens on |
COPILOT_AUTH_FILE | ~/.claude-copilot-auth.json | Path to auth token file |
BRAVE_API_KEY | (none) | Brave Search API key for web search |
WEB_SEARCH_MAX_RESULTS | 5 | Maximum search results per query |
DEBUG_STREAM | (none) | Set to 1 to enable debug logging |
Custom port deployment
To run the proxy on a different port:- Update docker-compose.yml:
- Start the container:
- Update Claude Code launch:
Custom auth file location
If your auth file is in a different location:- Update the volume mount in docker-compose.yml:
- Or use an environment variable:
Production best practices
Enable auto-restart
Therestart: always policy ensures the proxy:
- Starts automatically on system boot
- Recovers from crashes
- Stays running through Docker daemon restarts
Monitor container health
Set up monitoring to check if the proxy is responding:Resource limits
The proxy is lightweight, but you can set resource limits:docker-compose.yml
Secure the auth file
Ensure your auth file has restricted permissions::ro (read-only) to prevent the container from modifying it.
Troubleshooting
Container won’t start
Check logs:- Auth file not found: Run
node scripts/auth.mjsfirst - Port conflict: Change the host port in docker-compose.yml
- Permission denied: Check auth file permissions
Proxy not accessible
Verify container is running:Container keeps restarting
View exit code:- Exit 1: Auth file error or server startup failure
- Exit 137: Out of memory (increase memory limit)
- Exit 143: Graceful shutdown (SIGTERM)
Updating the proxy
When you pull new changes from the repository:- Rebuild the image:
- Restart with new image:
The
restart: always policy ensures the updated container starts automatically.Multiple instances
To run multiple proxy instances (e.g., for different auth tokens):- Create separate compose files:
docker-compose.dev.yml
- Start with specific compose file: