This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This repository provides ready-to-use Docker containers with the Claude Agent SDK and CLI pre-installed and pre-configured for non-interactive use. The CLI normally requires an interactive OAuth flow and onboarding wizard on first run, which is impractical in containers. These images handle that setup automatically.
The Claude CLI's first-run experience involves interactive prompts (onboarding wizard, project trust dialogs) that don't work in headless containers. While the CLI natively supports CLAUDE_CODE_OAUTH_TOKEN as an env var for authentication, it still expects onboarding and trust acceptance to have been completed.
Our solution: The entrypoint script pre-provisions the CLI configuration files (~/.claude.json, ~/.claude/.credentials.json) so the CLI starts in a fully configured state — no interactive prompts needed. Users run claude setup-token on their host machine to generate a long-lived access token (sk-ant-oat01-*) and pass it to the container as an environment variable.
- Primary method:
CLAUDE_CODE_OAUTH_TOKENenvironment variable with long-lived tokens - The entrypoint pre-provisions credential files and onboarding state so the CLI works non-interactively
- Fallback support for interactive auth (via
docker exec) and direct API keys
- The CLI (
claude) is installed via the native installer (curl https://claude.ai/install.sh | bash), not npm (npm install is deprecated for the CLI) - The SDK (
@anthropic-ai/claude-agent-sdk) and tsx are still installed via npm - Auto-updater is disabled in containers (
DISABLE_AUTOUPDATER=1in settings.json) — versions are pinned to image builds - Alpine images additionally need
libgcc,libstdc++,ripgrep, andUSE_BUILTIN_RIPGREP=0
-
Base TypeScript image (
Dockerfile.typescript):- Claude CLI via native installer + SDK/tsx via npm
- Includes tsx for direct TypeScript execution
- Sets up non-root user and proper permissions
-
Python extension (
Dockerfile):- Extends the TypeScript base (multi-language support)
- Adds Python 3.11 and claude-agent-sdk-python
- Maintains all JS/TS capabilities
examples/- Demonstration code showing SDK usage in each languagescripts/- Authentication helpers and test scriptscompose.yaml- Docker Compose configuration with proper environment variable handling.claude/- Claude CLI configuration scaffolding (copied into containers)
When modifying this repository:
- Maintain compatibility with long-lived OAuth tokens as the primary auth method
- Ensure examples work with token-based authentication
- Keep the non-root user setup for security best practices
- Test that authentication works in both TypeScript and Python environments
- Document any new environment variables or configuration options in the README