Images:
- TypeScript (607MB) - SDK and CLI are already included in the standard @anthropic-ai/claude-code package on NPM.
- π Python (693MB) - adds Python 3 and Anthropic's claude-code-sdk-python aka claude-code-sdk on PyPI.
- ποΈ Alpine TypeScript (383MB) - Minimal Alpine Linux base
- ποΈ Alpine Python (474MB) - Alpine with Python support
Problem: As of July, 2025, the Claude Code SDKs use the CLI OAuth flow, which is clunky inside a container.
Solution: These containers replace the CLI authentication with Long-lived access tokens. See: claude setup-token --help
Debian-based:
ghcr.io/cabinlab/claude-code-sdk:typescript
- CLI + TypeScript SDKghcr.io/cabinlab/claude-code-sdk:python
- Above + Python SDK
Alpine-based:
ghcr.io/cabinlab/claude-code-sdk:alpine
- Minimal TypeScriptghcr.io/cabinlab/claude-code-sdk:alpine-python
- Minimal + Python
-
Get your OAuth token (on host machine):
claude setup-token
# Follow Anthropic's 2 or 3 screens of auth flow CLI --> Browser --> CLI
# Copy the token that starts with "sk-ant-oat01-"
-
Set environment variable:
export CLAUDE_CODE_OAUTH_TOKEN=sk-ant-oat01-your-token-here
ALTERNATE:
# Copy .env.example to .env cp .env.example .env
# Edit .env and update this line with your actual token CLAUDE_CODE_OAUTH_TOKEN=sk-ant-oat01-your-token-here
-
Start the containers:
# Start containers (automatically uses .env file) docker compose up -d
-
Test it works:
# TypeScript (using compose.yaml) docker compose exec typescript node /app/scripts/test-auth.js # Python (using compose-python.yaml) docker compose -f compose-python.yaml exec python python /app/scripts/test_auth.py
Note: This project includes compose files for different variants:
compose.yaml
- Debian TypeScriptcompose-python.yaml
- Debian Pythoncompose-alpine.yaml
- Alpine TypeScriptcompose-alpine-python.yaml
- Alpine Python
# Start TypeScript container
docker compose up -d
# Run TypeScript example
docker compose exec typescript tsx /app/examples/typescript/hello.ts
# Interactive TypeScript development
docker compose exec typescript bash
# Start Python container
docker compose -f compose-python.yaml up -d
# Run Python example
docker compose -f compose-python.yaml exec python python /app/examples/python/hello.py
# Interactive Python development
docker compose -f compose-python.yaml exec python python
# Tip: If you only use Python, rename the file for convenience
mv compose-python.yaml compose.yaml
For users who prefer direct docker commands:
# TypeScript
docker run --rm -it \
-e CLAUDE_CODE_OAUTH_TOKEN="sk-ant-oat01-..." \
-v $(pwd):/app \
-p 3000:3000 \
ghcr.io/cabinlab/claude-code-sdk:typescript \
bash
# Python
docker run --rm -it \
-e CLAUDE_CODE_OAUTH_TOKEN="sk-ant-oat01-..." \
-v $(pwd):/app \
-p 3000:3000 \
ghcr.io/cabinlab/claude-code-sdk:python \
python
- Non-root user - Security best practice
- Claude Code CLI - Familiar Claude Code CLI and auth flow
- TypeScript SDK - Native TypeScript/JavaScript support
- tsx - Run TypeScript files directly without compilation
- Git, cURL, jq - Essential development tools
- Python SDK - Python bindings (in
:python
image)
Each container includes a .claude/
directory with:
- Slash Commands - Directory and instructions for extending Claude Code with custom commands
- Hooks - Directory and instructions to leverage Claude's behavior
- Example configurations and documentation
Mount your own configuration:
docker run -v ~/.claude:/home/claude/.claude ...
- Long-lived tokens [Recommended] β See Quick Start above
- Session based tokens - This is the standard Claude Code auth flow
- Anthropic API keys β Set
ANTHROPIC_API_KEY
in your.env
file - Can also be used through standard Claude Code auth flow
β οΈ Likely overrides OAuth/Subscription plan settings- β Use API OR Subscription, not both together
For technical details and troubleshooting, see our Authentication Guide.
Extending the Base Images (click to expand)
# For TypeScript projects
FROM ghcr.io/cabinlab/claude-code-sdk:typescript
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
CMD ["npm", "start"]
# For Python projects
FROM ghcr.io/cabinlab/claude-code-sdk:python
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "main.py"]
# Build TypeScript base
docker build -f Dockerfile.typescript -t claude-code-sdk:typescript .
# Build Python extension
docker build --build-arg BASE_IMAGE=claude-code-sdk:typescript \
-t claude-code-sdk:python .
- Containers run as non-root user
claude
- OAuth tokens should never be built into images
- Use
.aiexclude
to prevent Claude from accessing sensitive files - Mount secrets at runtime, don't embed them
See the examples/
directory for sample code in:
- JavaScript
- TypeScript (with direct execution via tsx)
- Python
This repository automatically checks for new SDK versions daily and creates pull requests when updates are available. The automated workflow:
- Runs daily at 2 AM UTC
- Checks npm for Claude Code CLI updates
- Checks PyPI for Python SDK updates
- Creates PRs with updated versions
- Auto-merges PRs after tests pass
Manual version checks can be triggered via the "Check for Updates" workflow in the Actions tab.
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a pull request
MIT License - see LICENSE file for details