Skip to content

Instantly share code, notes, and snippets.

@Kirill89
Last active July 2, 2026 09:12
Show Gist options
  • Select an option

  • Save Kirill89/1a35b141488d4ae4d4d3a2b7a10c7ba0 to your computer and use it in GitHub Desktop.

Select an option

Save Kirill89/1a35b141488d4ae4d4d3a2b7a10c7ba0 to your computer and use it in GitHub Desktop.
Claude Code in a disposable Docker container
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8
RUN apt-get update && apt-get install -y --no-install-recommends \
bash ca-certificates curl git jq openssh-client sudo \
build-essential python3 python3-pip python3-venv unzip \
libpcap-dev libpcap0.8 wget
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
RUN apt-get install -y --no-install-recommends nodejs
RUN rm -rf /var/lib/apt/lists/*
RUN npm install -g @anthropic-ai/claude-code
RUN mkdir -p /root/.npm-global
ENV PATH=/root/.npm-global/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
WORKDIR /root
RUN useradd -m -d /root -s /bin/bash claude
RUN usermod -a -G root claude
RUN echo 'claude ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/claude && chmod 0440 /etc/sudoers.d/claude
USER claude
IMAGE := claude-sandbox-vm
HOME_DIR := $(CURDIR)
.PHONY: build shell claude
.DEFAULT_GOAL := claude
build:
docker build -t $(IMAGE) .
shell: build
docker run --name $(IMAGE) --hostname $(IMAGE) --rm -it -v $(HOME_DIR):/root $(IMAGE)
claude: build
docker run --name $(IMAGE) --hostname $(IMAGE) --rm -it -v $(HOME_DIR):/root $(IMAGE) claude -r --dangerously-skip-permissions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment