Skip to main content

Run Claude Code CLI in a Podman container with tmux, GitHub access, and persistent config

Project description

Claude Code in Podman

Run Claude Code CLI inside a Podman container with GitHub access, persistent configuration, and a tmux session that lets you switch between Claude and a regular terminal.

Why?

Claude Code runs as a full CLI agent that can read, edit, and execute code in your project. Running it inside a container provides isolation — Claude operates in a sandboxed environment rather than directly on your host system.

The container includes tmux so you can open a shell alongside Claude (e.g. to run tests, inspect files, or use git) without leaving the container.

What's in the box

File Purpose
src/claude_podman/cli.py CLI entry point — builds the image and launches the container
src/claude_podman/Dockerfile Container image definition (see below for installed packages)
src/claude_podman/entrypoint.sh Starts Claude inside a tmux session
pyproject.toml Python package definition
DESIGN.md Original design requirements

Prerequisites

  • Podman installed
  • Python 3.10+
  • A Claude Code account (you'll authenticate on first run)
  • An SSH key for GitHub access (optional)

Quick start

Run from PyPI (no clone needed)

uvx claude-podman \
    --workspace ~/my-project \
    --github-key ~/.ssh/id_ed25519 \
    --claude-config ./claude-auth

Run directly from GitHub (no clone needed)

Not recommended - better check what you are running first!

uvx --from git+https://github.com/serge-m/claude-podman claude-podman \
    --workspace ~/my-project \
    --github-key ~/.ssh/id_ed25519 \
    --claude-config ./claude-auth

Run from a local clone

git clone https://github.com/serge-m/claude-podman.git
cd claude-podman
uv run claude-podman \
    --workspace ~/my-project \
    --github-key ~/.ssh/id_ed25519 \
    --claude-config ./claude-auth

Arguments

Argument Description
--workspace Path to your project directory (mounted as /workspace in the container)
--github-key (optional) Path to your SSH private key for GitHub (mounted read-only as /root/.ssh/id_ed25519 inside the container)
--claude-config Directory for Claude's persistent config (mounted as ~/.claude). Created automatically if it doesn't exist. Contains auth tokens, session history, etc.
--verbose Enable debug logging

Using tmux inside the container

Claude starts in a tmux session. Standard tmux keybindings apply:

Keys Action
Ctrl-b c Open a new terminal window
Ctrl-b n / Ctrl-b p Switch to next / previous window
Ctrl-b d Detach from tmux (exits the container)
Ctrl-b 0-9 Switch to window by number

What's installed in the container

Package Why
git, gh Version control and GitHub CLI
openssh-client SSH for GitHub push/pull
tmux Terminal multiplexer — run Claude and a shell side by side
curl, ca-certificates Fetching resources over HTTPS
mc, vim File management and text editing
build-essential C/C++ compiler toolchain (needed by some npm/pip packages)
python3-venv Python virtual environments
zsh Default shell
nodejs, npm Node.js runtime (required by Claude Code)
@anthropic-ai/claude-code Claude Code CLI (installed via npm)

GitHub's SSH host keys are pre-populated at build time via ssh-keyscan, so git operations won't prompt for host verification.

How it works

  1. claude-podman resolves all paths, reads your git identity from the host, extracts the bundled Dockerfile from the package, builds the container image, and runs it with the appropriate volume mounts.
  2. entrypoint.sh launches Claude inside a tmux session.
  3. Your workspace is bind-mounted into the container, so changes Claude makes are reflected on your host filesystem immediately.

Persistent config

The --claude-config directory stores Claude's authentication and session data. Point this at the same directory across runs to avoid re-authenticating each time. A .claude.json file is automatically created inside it if missing.

Note: The config directory contains auth credentials. Don't commit it to version control.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claude_podman-0.2.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claude_podman-0.2.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file claude_podman-0.2.0.tar.gz.

File metadata

  • Download URL: claude_podman-0.2.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for claude_podman-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f9080aa5c9e5a3b3caee7a66e50307a7bd387380ca604f1c123154b209bfbdfe
MD5 a0089f1644f84b067f503bedabf703df
BLAKE2b-256 8c2dcdff9387b00d4214408f5f19575467d761fc4de5d338bb1a00f166836c9e

See more details on using hashes here.

Provenance

The following attestation bundles were made for claude_podman-0.2.0.tar.gz:

Publisher: publish.yml on serge-m/claude-podman

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file claude_podman-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: claude_podman-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for claude_podman-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c6aee0d7aad2086e08dd4188ca57bd651246cef30a3e229f3020d8462bd633a
MD5 afd4135ffb8ec38e871c046dea5017ba
BLAKE2b-256 918b87589fe105b0e3514865c7a48eb19c0c889145fc96891af2c47fe888c29c

See more details on using hashes here.

Provenance

The following attestation bundles were made for claude_podman-0.2.0-py3-none-any.whl:

Publisher: publish.yml on serge-m/claude-podman

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page