Skip to main content
The Docker runtime is the production-ready backend for OpenSandbox Server, providing containerized sandbox environments with flexible networking options and comprehensive security controls.

Prerequisites

Before deploying with Docker runtime, ensure you have:
  • Docker Engine 20.10+ installed and running
  • Python 3.10+ for the OpenSandbox server
  • uv package manager (recommended) or pip
  • Operating System: Linux, macOS, or Windows with WSL2

Installation

1

Install OpenSandbox Server

Install the server package from PyPI:
For source development, clone the repository and run uv sync inside server/.
2

Initialize Configuration

Generate a Docker configuration file:
This creates a basic Docker runtime configuration at ~/.sandbox.toml.
3

Configure Runtime Settings

Edit ~/.sandbox.toml to customize your deployment. See Configuration Options below.
4

Start the Server

Launch the server with your configuration:
The server will start at http://0.0.0.0:8080 by default.
5

Verify Health

Check that the server is running:
Expected response:

Configuration Options

Basic Docker Configuration

Minimal configuration for Docker runtime:

Network Modes

Docker runtime supports two networking modes:

Host Mode

Containers share the host network stack for maximum performance:
Characteristics:
  • Direct port access without NAT
  • Best performance
  • Only one sandbox per port
  • Endpoint format: http://{domain}/{sandbox_id}/{port}

Bridge Mode

Isolated container networking with HTTP routing:
Characteristics:
  • Network isolation between containers
  • Multiple sandboxes can use the same port
  • Built-in HTTP routing support
  • Endpoint format varies by ingress configuration

Security Hardening

Apply security controls to Docker containers:
Refer to Docker container security documentation for more details.

Network Policy with Egress Sidecar

Control outbound network traffic with egress policies:
Requirements:
  • Only supported in bridge mode
  • Egress image must be configured when using networkPolicy
  • Automatically disabled for host mode
Example Request:

Advanced Docker Settings

Ingress Configuration

Configure how clients access sandboxes:

Direct Mode (Default)

Clients connect directly to sandboxes. No external gateway required.

Gateway Mode

Routing Modes:
  • Wildcard: <sandbox-id>-<port>.example.com/path/to/request
  • URI: 10.0.0.1:8000/<sandbox-id>/<port>/path/to/request
  • Header: gateway.example.com with header OpenSandbox-Ingress-To: <sandbox-id>-<port>

Storage Configuration

Control host path access for bind mounts:

Environment Variables

Override configuration with environment variables:

Example: Create a Sandbox

Once the server is running, create a sandbox:

Troubleshooting

Server Won’t Start

  • Verify Docker daemon is running: docker ps
  • Check configuration syntax: opensandbox-server init-config ~/.sandbox.toml
  • Enable debug logging: log_level = "DEBUG"

Connection Refused

  • Check DOCKER_HOST environment variable
  • Verify Docker socket permissions
  • Use remote Docker: export DOCKER_HOST="ssh://user@remote-host"

Network Policy Not Working

  • Ensure network_mode = "bridge"
  • Verify egress.image is configured
  • Check that egress image is accessible

Next Steps