This repository provides a minimal setup to run the Claude Code CLI inside a Docker container, with your local files mounted and credentials provided via an .env file.
- Build the docker image with
# minimal setup
docker build -t claude-cli -f Dockerfile.claude .
# or include dev tooling for Lighthouse development
docker build -t claude-cli -f Dockerfile.dev .
-
Create a file at
~/.claude_envwith any environment variables or credentials to use with Claude. -
Add an alias to your
~/.zshrc,~/.bashrcor~/.profile.:
# Add this line to ~/.zshrc
alias claude='docker run --rm -it \
-v "$(pwd)":"/home/claude/$(basename "$PWD")" \
-v "$HOME/.claude.json":/home/claude/.claude.json \
-v "$HOME/.claude":/home/claude/.claude \
-v "$HOME/.config/gh":/home/claude/.config/gh:ro \
-v "$HOME/.gitconfig":/home/claude/.gitconfig:ro \
-w "/home/claude/$(basename "$PWD")" \
--env-file $HOME/.claude_env \
claude-cli'
# Reload your shell
source ~/.zshrc
Note: The alias mounts ~/.config/gh (read-only) so Claude can use your existing GitHub CLI credentials without needing to login again.
- Usage: from any directory, just run:
claude
The container will start with your current directory and credentials loaded from ~/.claude_env.