Skip to main content
Sandboxes run inside gVisor (runsc). Docker is not installed automatically — you install it yourself after the sandbox is ready, then start dockerd with a small bootstrap script so nested containers work.

When to use this recipe

  • Spinning up Postgres, Redis, or other services with docker compose during a test run.
  • Letting an agent build and run containers without host Docker access.
  • Prototyping a multi-service setup in a disposable environment.

Prerequisites

  • A Brimble account with sandbox access and BRIMBLE_SANDBOX_KEY set.
  • The SDK installed (see SDKs).
  • Outbound network for pulling packages and images (egress.mode defaults to open).
  • A Debian/Ubuntu template such as ubuntu-24, node-22, or python-3.12 (images must have apt).
  • 1 GB+ RAM recommended (specs.memory: 1024 or higher).

Why a custom dockerd startup?

A plain apt install docker.io plus default dockerd often fails inside gVisor with overlay mount errors. Use a startup script that:
  1. Mounts tmpfs on /var/lib/docker — avoids overlay: invalid argument when pulling and running images.
  2. Runs dockerd with --iptables=false and --ip6tables=false — Docker does not manage iptables inside the sandbox; you set SNAT manually instead.
  3. Passes --feature containerd-snapshotter=false on Docker ≥ 29 — the default containerd snapshotter does not work in gVisor; the legacy storage path does.
Save this as start-dockerd.sh inside the sandbox (for example under /usr/local/bin/):
start-dockerd.sh

Recipe

Create a sandbox, install Docker, upload the script, start the daemon, then run a container.
exec requests accept timeout_seconds between 1 and 300. Split long apt-get runs or re-run install if needed.

Without uploading a file

You can inline the same steps with shell exec if you prefer not to upload start-dockerd.sh:

What’s happening

  1. create. Blocks until the sandbox VM is ready (gVisor container running, no Docker yet).
  2. apt-get install docker.io. Installs the Docker engine and CLI on Debian/Ubuntu.
  3. start-dockerd.sh. Mounts tmpfs on /var/lib/docker, configures SNAT for outbound traffic, and starts dockerd --iptables=false --ip6tables=false with --feature containerd-snapshotter=false when Docker is version 29 or newer.
  4. docker run. Talks to the local daemon over /var/run/docker.sock inside the sandbox.
  5. --network=host. Port mapping via -p is not supported inside sandboxes — bind on the host network instead when exposing services.
If you pause and resume a sandbox, reinstall Docker and restart dockerd — the daemon does not persist across resume.

Limitations

  • Template OS: agent-only images (for example codex, bun-1) may not have apt; use ubuntu-24, node-22, or python-3.12.
  • Port mapping: use --network=host, not -p / --expose.
  • Install time: first apt-get install can take several minutes; use the maximum timeout_seconds (300) per exec call.
  • Performance: nested containers are slower than running Docker on a bare VM.
  • Resume: after pause/resume, run the install and start-dockerd.sh steps again.

Next steps

Last modified on July 1, 2026