container is Apple's tool that you can use to create and run Linux containers as lightweight virtual machines on your Mac. Requires Apple Silicon and macOS 26+.
This guides you through running Claude in a container.
There is a single catalog that can be written by both host and guest. No other access from guest to host is allowed.
Download the latest .pkg-packet from github.com/apple/container/releases. Pick the signed package.
Double click and follow the installation guide.
Start the service
container system startAccept the default kernel.
Verify that everything is running
container system statusmkdir -p ~/code/shared # Catalog shared guest <-> host
mkdir -p ~/claude-sandbox
touch ~/claude-sandbox/Dockerfile
cd ~/claude-sandboxThis Dockerfile installs asdf, node and Claude Code. You add whatever you want to add.
FROM ubuntu:24.04
RUN apt-get update && apt-get install -y --no-install-recommends \
curl git ca-certificates sudo \
dirmngr gpg gawk \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -m -s /bin/bash claude && \
echo "claude ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
USER claude
WORKDIR /home/claude
# Installer asdf for tool version handling (Go-binary, v0.16+)
ARG ASDF_VERSION=v0.16.7
RUN curl -fsSL \
"https://github.com/asdf-vm/asdf/releases/download/${ASDF_VERSION}/asdf-${ASDF_VERSION}-linux-arm64.tar.gz" \
| tar -xz -C /tmp && \
mkdir -p ~/.local/bin && \
mv /tmp/asdf ~/.local/bin/asdf
# Add to PATH to get it to work in interactive shells
RUN echo 'export PATH="$HOME/.local/bin:$HOME/.asdf/shims:$PATH"' >> ~/.bashrc && \
echo 'export PATH="$HOME/.local/bin:$HOME/.asdf/shims:$PATH"' >> ~/.profile
ENV PATH="/home/claude/.local/bin:/home/claude/.asdf/shims:$PATH"
# Install node via asdf
RUN asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git && \
asdf install nodejs latest && \
asdf set -u nodejs latest
# Install Claude
RUN curl -fsSL https://claude.ai/install.sh | bash
WORKDIR /workspace
container build -t claude-sandbox .check that image exists
container image lscontainer run -it \
--name claude-sandbox \
--cpus 4 \
--memory 4G \
-v "$HOME/code/shared:/workspace" \
-u claude \
-w /workspace \
claude-sandbox \
bashInside container
claude
or if you're feeling it
claude --dangerously-skip-permissionsTo make it easier to start, you can use this startup script.
Create e.g this file ~/claude-sandbox/start.sh
#!/bin/bash
set -e
# Start Apple Container-service
if ! container system status &>/dev/null; then
container system start
fi
# Start container if stopped
if container ls -a | grep -q "claude-sandbox"; then
container start claude-sandbox 2>/dev/null || true
container exec -it -u claude claude-sandbox bash -c \
'cd /workspace && claude --dangerously-skip-permissions'
else
# Create container if it doesn't exists
container run -it \
--name claude-sandbox \
--cpus 4 \
--memory 4G \
-v "$HOME/code/shared:/workspace" \
-u claude \
-w /workspace \
claude-sandbox \
bash -c 'claude --dangerously-skip-permissions'
fiFix permissions
chmod +x ~/claude-sandbox/start.shRun as
~/claude-sandbox/start.shThis in your .zshrc/.bashrc/.whateverrc gives you the command claudex which you can run from a folder open Claude, for that folder, in a sandbox.
alias sandbox='container exec -it -u claude claude-sandbox bash'
claudex() {
local shared_base="$HOME/code/shared"
local current="$(pwd)"
if [[ "$current" != "$shared_base"* ]]; then
echo "❌ Not in a folder shared with sandbox. Navigate somewhere under $shared_base and run it again"
return 1
fi
local relative="${current#$shared_base}"
local guest_dir="/workspace${relative}"
container exec -it -u claude claude-sandbox bash -c "cd '$guest_dir' && claude --dangerously-skip-permissions"
}List containers:
container lsIf it shows up, you can stop buildkit, if you want to. It will autostart when building an image.
container builder stopList containers, including stoppped
container ls -aConnect to guest
container exec -it -u claude claude-sandbox bashor add it as an alias in your ~/.zshrc, ~/.bashrc, etc
alias sandbox='container exec -it -u claude claude-sandbox bash'or quick command into Claude
container exec -it -u claude claude-sandbox bash -c 'claude --dangerously-skip-permissions'or add that as an alias
alias claudes='container exec -it -u claude claude-sandbox bash -c "claude --dangerously-skip-permissions"'