Run Claude Code with Podman
run.sh starts Claude Code under rootless Podman on the
current directory, passing any arguments to claude.
- Images
- GHCR
ghcr.io/hambn/claude-code - Docker Hub
docker.io/hambn/claude-code
- GHCR
- Use case
- Rootless sessions on a workstation
Prerequisites
- Rootless Podman 4.3 or later, for
--userns=keep-id:uid=1000,gid=1000. - An Anthropic API key in
ANTHROPIC_API_KEY.
Run Claude Code
Shell
export ANTHROPIC_API_KEY=sk-ant-...
./run.shVariables
| Variable | Required | Purpose |
|---|---|---|
ANTHROPIC_API_KEY |
yes | Forwarded to the container; the script stops if it is unset. |
CLAUDE_CODE_IMAGE |
no | Image to run. Defaults to ghcr.io/hambn/claude-code:ubuntu-browser; set a digest reference to pin one build. |
Workspace
The current directory is mounted at /workspace with :Z, so SELinux hosts relabel it
for the container. --userns=keep-id maps your host user to sysadmin (UID 1000), so
files Claude Code writes stay owned by you.
Files
run.shruns the published image with rootless Podman.
File contents
run.sh10 lines
#!/usr/bin/env bash
# Run Claude Code rootlessly against the current directory; :Z relabels it on SELinux hosts.
set -euo pipefail
: "${ANTHROPIC_API_KEY:?Set ANTHROPIC_API_KEY}"
image=${CLAUDE_CODE_IMAGE:-ghcr.io/hambn/claude-code:ubuntu-browser}
podman run -it --rm --userns=keep-id:uid=1000,gid=1000 \
-e ANTHROPIC_API_KEY \
-v "$PWD:/workspace:Z" \
"$image" "$@"