Configuration#
The sandbox reads /etc/claude-sandbox.conf inside the container and
CLAUDE_SANDBOX_* environment variables. With the PyPI host launcher, create
~/.config/claude-sandbox.conf on the host; it is mounted read-only at that
container path. See mounting the config.
On the host, claude-sandbox launches containers. Inside the container, the
same name is an administrative helper (verify, gh-auth, version, etc.).
Run claude-sandbox --help on the host for launcher options.
/etc/claude-sandbox.conf#
The shadow reads this file at every launch. It is seeded by
install.sh from the bundled
.devcontainer/claude-sandbox.conf (the shipped defaults). It lives at
/etc, not in the rw-bound workspace, so a compromised session
cannot rewrite it to widen the next launch’s binds — or, with
allow-ip, its network reach.
For your own devcontainer, edit /etc/claude-sandbox.conf directly in the container
(you are root); the next claude launch picks it up. Edits are
per-devcontainer and not persisted: a rebuild, re-install, or
claude-sandbox update restores the shipped defaults, so re-apply
afterwards. Teams that want a persistent conf bake it in at install
time — see
Sandbox a team devcontainer.
A missing file is a no-op (parse_config returns). The installer
skips placing it if the clone carries no conf. File mode is 0644.
Format#
One directive per line.
key = value, or a barekeyfor boolean flags.Blank lines and
#comments are ignored.Environment variables take precedence for scalar settings such as
workspace-root. Repeatable lists such asallow-writeandlocal-portappend config entries to the environment values.
Keys#
Key |
Value |
Effect |
|---|---|---|
|
absolute path |
Sets the rw bind-mount root if |
|
bare flag (no value) |
Equivalent to |
|
absolute path |
Adds an extra writable bind. Repeatable — each |
|
variable name(s) |
Forwards named environment variables through the |
|
TCP port 1–65535; shipped default |
The port Pi discovers a model on at startup. Always part of the loopback relay set (20. Relay a set of loopback ports to every agent), so every agent reaches it on its own |
|
TCP port 1–65535 |
Adds a port to the loopback relay set: the outer container’s |
|
TCP port 1–65535; disabled by default (commented examples) |
Reverse relay: exposes an agent’s loopback listener on the outer container’s loopback for browser OAuth. Repeatable; merged with |
|
bare flag / |
The per-process network egress jail (15. Jail Claude’s egress in a per-process netns with a routing allowlist) is ON by default and fail-closed; the key normally never needs to appear. An operator opt-out value exists but is deliberately not documented here — weakening the sandbox is discouraged. |
|
bare IP (no CIDR) |
A device IP the egress jail keeps reachable past its RFC1918 blackhole (e.g. an EPICS IOC / PMAC / internal GitLab by bare address). Repeatable — each line punches one |
# .devcontainer/claude-sandbox.conf (installed to /etc/claude-sandbox.conf)
allow-write = /cache
allow-write = /workspaces/sibling-project
pass-env = DOCKER_HOST
# Keep these device IPs reachable past the RFC1918 blackhole (bare IP):
allow-ip = 172.23.142.119 # internal GitLab
pass-env deny-list#
These names are ignored, and the sandbox’s own value always wins:
Names |
Why |
|---|---|
|
The sandbox sets each of these itself. Forwarding |
|
Agent configuration locations and profile selection remain controlled by the wrapper |
|
Loader and shell startup hooks — they execute code in every process the session spawns |
Environment variables#
With the host launcher, CLAUDE_SANDBOX_* variables are forwarded at container
creation; recreate to change them. Other host variables are not forwarded.
Inside your own devcontainer, set variables in the launching terminal or
remoteEnv. Config-file settings are usually simpler for durable host-launcher
configuration.
Variable |
Set by / read by |
Meaning |
|---|---|---|
|
you ( |
Explicit rw bind-mount root. Set to |
|
you ( |
|
|
you (env, per session) / conf |
Network egress jail toggle (15. Jail Claude’s egress in a per-process netns with a routing allowlist). Default ON, fail-closed: with the jail on but |
|
populated by |
Newline-separated device IPs the jail keeps reachable past the RFC1918 blackhole |
|
you (env, per session) and |
Extra outer-loopback TCP ports relayed into the jail, space-, comma- or newline-separated. Conf entries are appended to whatever the environment already holds, so |
|
you (env, per session) / conf |
The model port Pi discovers on; always in the relay set. |
|
you (env, per session) and |
Outer-loopback TCP ports relayed into the jail for browser OAuth callbacks, space-, comma- or newline-separated. Conf entries are appended to the environment’s, so |
|
set by bwrap ( |
Marker preventing recursive wrapping of nested agent calls. It is not independent proof of isolation |
|
populated by |
Newline-separated extra writable paths bound in addition to the workspace |
|
populated by |
Names of environment variables to forward into the sandbox. Set it directly to forward a variable for one session without editing the conf |
|
exported by the shadow |
Path to the curated gitconfig ( |
|
set to |
Disables Claude Code’s in-container auto-updater (alongside |
CLAUDE_SANDBOX_NO_FORGE is documented as a task in
run a no-push session; workspace scope
is covered in widen the writable workspace;
forwarding variables is covered in
pass environment variables in.