version: '3.8' services: claude-code: build: context: . dockerfile: Dockerfile image: claude-code:latest container_name: claude-code-cli # Environment variables environment: - DOCKER_HOST=unix:///var/run/docker.sock - TERM=xterm-256color # Pass through user UID/GID for file permissions - USER_UID=${USER_UID:-1000} - USER_GID=${USER_GID:-1000} # Volume mounts volumes: # Claude config (persistent) - ${HOME}/.claude:/home/claude/.claude # Project directory (customize per project) - ${PROJECT_DIR:-${PWD}/workspace}:/workspace # Docker socket for Docker-in-Docker - /var/run/docker.sock:/var/run/docker.sock # Optional: SSH keys for git operations - ${HOME}/.ssh:/home/claude/.ssh:ro # Optional: Git config - ${HOME}/.gitconfig:/home/claude/.gitconfig:ro # Working directory working_dir: /workspace # Security options security_opt: - seccomp:unconfined # Required for some dev tools # User mapping (run as non-root) user: "${USER_UID:-1000}:${USER_GID:-1000}" # Interactive terminal stdin_open: true tty: true # Resource limits (optional) deploy: resources: limits: cpus: '4' memory: 8G reservations: cpus: '2' memory: 2G # Restart policy restart: unless-stopped