Skip to content

RadianDevCore - AI - claude-code-container

gcil mise pre-commit-crocodile guidelines

Launch Claude Code inside a Debian container in the current folder

Documentation: https://radiandevcore.gitlab.io/ai/claude-code-container

  • Copyright: 2026 Adrian DC
  • Project: RadianDevCore - AI
  • Maintainer: Adrian DC

Installation

mise use -g gitlab:RadianDevCore/ai/claude-code-container@latest

Examples

# Launch Claude Code in the current folder
claude-code-container

# Continue the last conversation, with the current folder mounted read-only
claude-code-container --read-only --continue

# Mount another folder and pass a host environment variable
claude-code-container -v ../shared-library -e GITLAB_TOKEN

Usage

usage: claude-code-container [-h] [--version] [--update] [--build] [--read-only] [-e VAR[=VALUE]] [-v PATH[:ro]]
                             [--shell | --upgrade | --cost] [--] [CLAUDE_ARGS ...]

claude-code-container: Launch Claude Code inside a container in the current folder

internal arguments:
  -h, --help                          # Show this help message
  --version                           # Show the current version
  --update                            # Update to the latest release

modes arguments:
  --shell                             # Launch a 'bash' shell in the container instead
  --upgrade                           # Upgrade Claude Code with 'mise' in the container volume
  --cost                              # Show the Claude Code '/cost' usage summary and exit

container arguments:
  --build                             # Rebuild the container image with logs (pull base image, no cache)
  --read-only                         # Mount the current folder read-only in the container
  -e, --env VAR[=VALUE]               # Set a container environment variable
                                      # (host value without VALUE)
  -v, --volume PATH[:ro]              # Mount a host folder or file at its real host path and symlink path
                                      # (read-only with ':ro')

positional arguments:
  --                                  # Positional arguments separator (recommended)
  CLAUDE_ARGS                         # Arguments passed to Claude Code

environment variables:
  CLAUDE_CODE_CONTAINER_ENGINE        # Container engine (default: podman, else docker)
  CLAUDE_CODE_CONTAINER_IMAGE         # Container image (default: claude-code-container:local)
  CLAUDE_CODE_CONTAINER_VOLUME        # User home volume (default: claude-code-container)
  CLAUDE_CODE_CONTAINER_NETWORK       # Container network (default: host, or bridge)
  CLAUDE_CODE_CONTAINER_GITCONFIG     # Git configuration mounted read-only (default: 0, 1 for '~/.gitconfig', or a path)
  CLAUDE_CODE_CONTAINER_GITDIRS       # Git submodules and worktrees folders mounted (default: 1, 0 to disable)
  CLAUDE_CODE_CONTAINER_HOSTHOME      # Home folder paths mounted under '/home/host' (default: 1, 0 for real paths)
  CLAUDE_CODE_CONTAINER_HISTORY_DAYS  # Claude Code history retention days (default: 7, 0 for Claude Code defaults)
  CLAUDE_CODE_EXPERIMENTAL_CODE_MODE  # Claude Code experimental code mode (default: 1)

Container details

Image and volume

  • Image: built locally on first use, from debian:13-slim with mise (installed with extrepo)
  • Claude Code: installed on first use with mise use -g claude@latest
  • Volume: claude-code-container keeps /home/claude (login, configurations, mise installations)
  • Project: the current folder is mounted at the same path, with files owned by the host user
  • Mounts: -v paths keep their host path, symlinks are also mounted at their own path
  • Home paths: paths inside the host home folder are mounted under a fake /home/host folder
  • Launch summary: mounts, network, security and privacy details are shown on each launch

Security

  • Only the current folder and the volume are accessible, not the host home folder
  • Paths inside the host home folder are mounted under /home/host (like ~/projects/app at /home/host/projects/app), to hide the host user name and home path from the container
    • Git worktrees with absolute .git references outside the current folder still use their real host paths
    • Claude Code sessions are stored per path, so previous sessions of such folders are not listed after enabling it
  • Refused folders, also through symlinks, to avoid exposing the whole host:
    • The ~ folder and its parents (like /)
    • System folders (like /tmp or /etc)
    • Runtime folders (like /run or /dev)
  • No privileges escalation, all capabilities dropped once the entrypoint switches to the host user, and a processes limit
  • Folders on FUSE mounts (like sshfs) require the allow_other option with docker

Network

  • The host network is used by default, for reliable DNS (like with VPN resolvers)
  • It also exposes the host localhost services, use CLAUDE_CODE_CONTAINER_NETWORK=bridge to isolate the container

Git

  • The host Git configuration is not mounted by default, for privacy
  • Git submodules and worktrees folders (.git files pointing outside the current folder) are mounted at their real host paths (read-only with --read-only)

Privacy

  • Telemetry, error reporting, /bug command and feedback surveys are disabled by default
  • Conversations history is kept for 7 days by default

Environment variables

Variable Default Usage
CLAUDE_CODE_CONTAINER_NETWORK host bridge to isolate the container network
CLAUDE_CODE_CONTAINER_GITCONFIG 0 1 for ~/.gitconfig, or a path (like a dedicated identity), mounted as /etc/gitconfig
CLAUDE_CODE_CONTAINER_GITDIRS 1 0 to not mount Git submodules and worktrees folders
CLAUDE_CODE_CONTAINER_HOSTHOME 1 0 to mount home folder paths at their real host paths instead of /home/host
CLAUDE_CODE_CONTAINER_HISTORY_DAYS 7 Conversations history days, 0 for Claude Code defaults
CLAUDE_CODE_EXPERIMENTAL_CODE_MODE 1 0 to disable the experimental code mode
DISABLE_TELEMETRY 1 0 to enable telemetry
DISABLE_ERROR_REPORTING 1 0 to enable error reporting
DISABLE_BUG_COMMAND 1 0 to enable the /bug command
CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY 1 0 to enable feedback surveys
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC unset Passed to the container when set on the host
NO_COLOR unset Disable the launch summary colors (only colored on terminals)

Updates

  • Show claude-code-container version :
claude-code-container --version
  • Upgrade Claude Code with mise in the container volume :
claude-code-container --upgrade
  • Rebuild the container image with logs (latest Debian 13 packages and mise) :
claude-code-container --build
  • Update claude-code-container to the latest release :
claude-code-container --update
  • Reset the Claude Code login and installations volume :
docker volume rm claude-code-container

Development

  • Use claude-code-container from sources with mise-en-place :
{
  git clone https://gitlab.com/RadianDevCore/ai/claude-code-container.git
  cd ./claude-code-container/
  mise install
  mise use -g "gitlab:RadianDevCore/ai/claude-code-container@path:${PWD}"
}
  • Build and test the release archive :
mise run build:release
mise run test:release
  • Restore claude-code-container latest release :
mise use -g gitlab:RadianDevCore/ai/claude-code-container@latest

References