The Docker runtime is the simplest way to run OpenSandbox locally and on a single host. It talks directly to the Docker daemon and manages sandbox containers, expiration timers, volumes, port mappings, optional egress sidecars, and OCI snapshots — all without a Kubernetes cluster. This makes it the default choice for local development, CI pipelines, and single-machine deployments where you need fast iteration and minimal infrastructure overhead.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/opensandbox-group/OpenSandbox/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
| Requirement | Details |
|---|---|
| Docker Engine | 20.10+ |
| OpenSandbox server | Installed via uv pip install opensandbox-server |
| Operating system | Linux, macOS, or Windows with WSL2 |
Quick Setup
Generate a Docker config file
The
init-config command scaffolds a ready-to-use TOML file for the Docker runtime.Review and edit the generated config
Open
~/.sandbox.toml and verify the [docker] section matches your environment. In particular, set host_ip if the server itself runs inside a container.Docker Configuration Reference
All Docker-specific settings live under the[docker] section of your TOML config.
| Key | Default | Description |
|---|---|---|
network_mode | "host" | Container network mode: host, bridge, or a custom Docker network name |
host_ip | (unset) | Public host IP or hostname used to format sandbox endpoints in bridge mode |
drop_capabilities | See example | Linux capabilities to drop from sandbox containers |
no_new_privileges | true | Prevent containers from gaining new privileges via setuid/setgid |
pids_limit | 4096 | Maximum number of PIDs per sandbox container (null to disable) |
For production environments with many concurrent sandboxes, set
pids_limit to 4096 or higher to avoid “can’t start new thread” errors. See issue #447 for details.Network Modes
OpenSandbox supports two network modes for Docker-backed sandboxes. Choose the one that fits your deployment scenario.- Bridge mode (recommended)
- Host mode
Bridge mode places each sandbox on an isolated Docker network. The Docker runtime maps only the How endpoint routing works in bridge mode:
execd proxy port (44772) and, optionally, port 8080. All other container ports are reached through the built-in execd reverse proxy.execdlistens on container port44772and bundles a lightweight reverse proxy.- The Docker runtime binds a random host port to the container’s
44772proxy port. get_endpoint(port=X)returns{host_ip}:{host_proxy_port}/proxy/{X}.- HTTP, SSE, and WebSocket traffic all share that single host port — no additional port mappings needed.
- For callers inside the same Docker network, use
get_endpoint(resolve_internal=True)to receive the container IP directly.
Private Registry Access
To pull sandbox images from a private container registry, supply credentials either at sandbox creation time or globally in the config.- Per-sandbox (SDK)
- Global config (TOML)
Pass
image_auth_username and image_auth_password in the image field when creating a sandbox:Resource Limits
CPU and memory limits are passed at sandbox creation time and enforced by the Docker runtime. Use Kubernetes-style resource strings.- Python SDK
- REST API
| Resource key | Example values | Notes |
|---|---|---|
cpu | "500m", "2" | Millicores (m) or whole cores |
memory | "512Mi", "4Gi" | Binary suffixes (Mi, Gi) |
gpu | "1" | GPU count; requires GPU-capable Docker runtime |
Volume Mounts
The Docker runtime supports host bind mounts and named Docker volumes.- Host path bind mount
- Named volume (PVC model)
Mount a host directory into the sandbox container:
Egress Network Policy
When a sandbox is created with anetworkPolicy, the Docker runtime attaches an egress sidecar container that shares the sandbox’s network namespace. The sidecar enforces FQDN-based allow/deny rules on all outbound traffic.
[egress]:
Secure Container Runtimes
To add kernel-level isolation beyond standard Docker containers, configure a secure OCI runtime in[secure_runtime].
secureRuntime: true in the request.
gVisor (
runsc) does not support the iptables nat table required by the egress sidecar’s DNS interception. If you need both syscall isolation and FQDN egress control, use kata-qemu instead. See the Secure Container guide for the full compatibility matrix.Running the Server in Docker
You can run the OpenSandbox server itself as a Docker container and have it manage other containers on the same host. Mount the Docker socket so the server can talk to the Docker daemon.host_ip to host.docker.internal (Docker Desktop) or the host’s LAN IP so that sandbox endpoints are reachable from outside the container.
Related
- Server Deployment — Full server configuration reference
- Architecture Overview — How the Docker runtime fits into the platform
- Network Architecture — Single-host routing and bridge mode details
- Secure Container — gVisor, Kata, and Firecracker on Docker
- Credential Vault — Automatic credential injection via the egress sidecar