Skip to content

Instantly share code, notes, and snippets.

@ChieftainY2k
Created July 9, 2026 08:49
Show Gist options
  • Select an option

  • Save ChieftainY2k/c5382702070c763c11c17b7086ee2e7e to your computer and use it in GitHub Desktop.

Select an option

Save ChieftainY2k/c5382702070c763c11c17b7086ee2e7e to your computer and use it in GitHub Desktop.
Claude in docker container (handy as a bash function)
claude-docker() {
docker image inspect claude-code-slim >/dev/null 2>&1 || docker build -t claude-code-slim -<<'EOF' || return 1
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y curl ca-certificates git && rm -rf /var/lib/apt/lists/*
RUN useradd -m claude
USER claude
ENV HOME=/home/claude
RUN curl -fsSL https://claude.ai/install.sh | bash
ENTRYPOINT ["/home/claude/.local/bin/claude"]
EOF
docker run --rm -it \
-u "$(id -u):$(id -g)" \
-e HOME=/home/claude \
-v "$PWD:$PWD" \
-v claude-home:/home/claude/.claude \
-v claude-local:/home/claude/.local \
-w "$PWD" \
claude-code-slim
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment