Skip to main content
Enabling the Docker agent sandbox, and fixes for sandbox images, permissions, and Control UI pairing. Part of the Docker guide.

Agent sandbox

When agents.defaults.sandbox is enabled with the Docker backend, the gateway runs agent tool execution (shell, file read/write, etc.) inside isolated Docker containers while the gateway itself stays on the host — a hard wall around untrusted or multi-tenant agent sessions without containerizing the whole gateway. Sandbox scope can be per-agent (default), per-session, or shared; each scope gets its own workspace mounted at /workspace. You can also configure allow/deny tool policies, network isolation, resource limits, and browser containers. For full configuration, images, security notes, and multi-agent profiles:

Quick enable

Build the default sandbox image (from a source checkout):
For npm installs without a source checkout, see Sandboxing § Images and setup for inline docker build commands.

Troubleshooting

Build the sandbox image with scripts/sandbox-setup.sh (source checkout) or the inline docker build command from Sandboxing § Images and setup (npm install), or set agents.defaults.sandbox.docker.image to your custom image. Containers are auto-created per session on demand.
Set docker.user to a UID:GID that matches your mounted workspace ownership, or chown the workspace folder.
OpenClaw runs commands with sh -lc (login shell), which sources /etc/profile and may reset PATH. Set docker.env.PATH to prepend your custom tool paths, or add a script under /etc/profile.d/ in your Dockerfile.
A local source image build needs at least 6 GB RAM. Use a larger machine class or a pre-built image and retry.
Fetch a fresh dashboard link and approve the browser device:
More detail: Dashboard, Devices.
Reset gateway mode and bind: