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.
claude-sandbox is one command in every context. On the host it launches
project containers, and forwards helpers such as verify, gh-auth and
version into the project container. Inside the container it runs those
helpers. Inside an agent session, helpers that would take a credential or
change the installation refuse. Run claude-sandbox --help in each place
for the commands available there; on the host it also lists the launcher
options.
/etc/claude-sandbox.conf#
The wrapper reads this file at each launch. It is outside the writable workspace, so an agent cannot change future sessions’ access.
For your own devcontainer, edit it in a container terminal outside the agent. Rebuilds and reinstalls restore shipped defaults; apply durable changes through team setup.
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 a writable path; repeatable. Empty or missing paths are skipped; a relative path refuses the launch, since it would resolve against the writable workspace. Never expose host container-engine, session-bus or X11 sockets: they grant control beyond the sandbox. See socket access |
|
variable name(s) |
Forwards named environment variables through the |
|
absolute |
Exposes one existing character or block device read-write to agents using a device bind. Repeatable; merged with the environment. Symlinks resolve to their canonical path. Missing or invalid devices fail launch. Container access must already be configured; the host launcher |
|
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 / |
Network isolation is on by default and refuses launch if prerequisites are missing. Environment override takes precedence; see the threat model for disabling it |
|
bare flag |
Experimental and under development, like the host launcher’s |
|
bare IP (no CIDR) |
Allows an IP through the network jail; repeatable. Grants access to the whole device, not one service. A prefix is narrowed to the address written before the |
# .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. Overrides could bypass wrapper controls |
|
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, apart from the launcher’s own settings such as
CLAUDE_SANDBOX_IMAGE and CLAUDE_SANDBOX_ENGINE; 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 an absolute path, such as |
|
you ( |
|
|
you (env, per session) / conf |
Overrides |
|
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 |
|
launcher |
Newline-separated device paths to expose inside the jail; setting this alone does not mount devices into the outer container |
|
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 |
|
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.