Claude Code¶
Claude Code CLI for AI-assisted development directly inside workspace containers.
To enable Claude Code CLI, set the CLAUDE_CODE argument to YES in the compose.yaml file of your desired workspace (e.g., template_ws/docker/compose.yaml). After making these changes, rebuild the Docker image.
Installation¶
The module automatically installs Claude Code CLI (latest version) using the official installer from https://claude.ai/install.sh.
Usage¶
After building a workspace with Claude Code enabled, you can use the CLI inside the container:
# Start your workspace container
cd ~/ros2-essentials/template_ws/docker
docker compose up -d
docker exec -it ros2-template-ws bash
# Inside the container, verify Claude Code is installed
claude --version
# Run Claude Code CLI
claude
The first time you run Claude Code, you'll be prompted to authenticate with your Anthropic account.
If you want to run Claude Code CLI to run continuously without asking for permissions, make sure to comment out privileged: true in the compose.yaml file and restart the container. Then run:
This is not as secure as the official container due to the lack of firewall protection. But it should be fine for most cases as it's inside a container.
Authentication¶
Claude Code caches login details locally at ~/.claude.json and ~/.claude/. The default compose.yaml mounts <git_root_dir>/.env/.claude to /home/user/.claude and <git_root_dir>/.env/.claude.json to /home/user/.claude.json so credentials can persist across containers.
References¶
For more discussions on AI coding assistants (such as Cursor etc.), please refer to issue #102.