We Reverse-Engineered Docker Sandbox's Undocumented MicroVM API Docker has introduced an undocumented API for spawning microVMs, which the author reverse-engineered to create the open-source Sandbox Agent SDK. Unlike standard containers, which share the host kernel and are unsuitable for untrusted code execution, Docker Sandboxes use microVMs to provide stronger isolation for safely running AI coding agents and other untrusted workloads. The API, managed by a daemon listening on a Unix socket, allows creating, listing, and destroying VMs, though it is currently limited to Docker's whitelisted agents on macOS and Windows with nested virtualization. Docker ships with an undocumented API for spawning microVMs. We reverse-engineered it and built the open-source Sandbox Agent SDK to allow orchestrating coding agents inside of them. Docker & containers are the standard for how we’ve been running backends. Recently, more workloads have been moving to sandboxes for untrusted code execution, which Docker is not suitable for. With the launch of Docker Sandboxes, Docker quietly shipped an undocumented API for microVMs that can power sandboxes. This looks promising to be a unified way of managing sandboxes on your own infrastructure using microVMs, just like Docker did for containers 10 years ago. Today it only supports macOS/Windows. Requires nested virtualization. What Are Docker Sandboxes? what-are-docker-sandboxes Docker Sandboxes https://docs.docker.com/ai/sandboxes/ launch post https://www.docker.com/blog/docker-sandboxes-a-new-approach-for-coding-agent-safety/ are Docker’s solution for running AI coding agents safely. Claude Code, Codex, and Gemini need to run arbitrary code, install packages, and modify files. MicroVMs let them run --dangerously-skip-permissions without being dangerous. Docker shipped a simple CLI: docker sandbox run claude ~/project At first glance, this looks like a glorified docker run command, but under the hood Docker is using a completely different technology: microVMs . MicroVMs vs Containers: Looking Under The Hood micro-vms-vs-containers-looking-under-the-hood Containers are what most developers know and love when they run docker run . They provide basic file system, network, and process isolation between the host machine. However, it’s a common misconception that containers are good enough for running untrusted code AI agents, user-submitted scripts, multi-tenant plugins . By design, containers share the host’s kernel in order to be fast and lightweight. However, that means that a compromised container can put the host at risk. The security implications of using containers is a longer topic, but most of the industry agrees that containers are a bad practice for untrusted code execution. In order to achieve better security, products like AWS Lambda, Fly.io, and most sandbox providers use microVMs for lightweight virtual machines with separate kernels for better security. It’s lighter than a full virtual machine, but does not carry as much overhead. This is considered the gold standard of isolating user code. There are many https://github.com/firecracker-microvm/firecracker?tab=readme-ov-file what-is-firecracker other https://www.koyeb.com/blog/10-reasons-why-we-love-firecracker-microvms documents https://firecracker-microvm.github.io/ that better describe microVMs & Firecracker if you’d like to read more. This is why Docker built Sandboxes on microVMs instead of containers while remaining compatible with Docker containers. This is how the two compare: | Docker Container | Docker Sandbox | | |---|---|---| Security | Shared kernel namespaces | Separate kernel microVM | Untrusted code | Not safe | Safe | Network access | Direct HTTP | Via filtering proxy | Volumes | Direct mount | Bidirectional file sync | Platform | Linux, macOS, Windows | macOS, Windows only | Use Cases use-cases This opens up use cases that containers can’t safely handle: Untrusted code execution : Run user-submitted scripts without risking your host AI coding agents : Let Claude/Codex run with full permissions safely Multi-tenant plugins : Isolate customer code in SaaS applications Secure CI/CD : Run builds with VM-level isolation instead of containers The MicroVMs API the-micro-vms-api docker sandbox run is strictly limited to Docker’s whitelisted agents: Claude, Codex, Gemini, Copilot, Kiro, and Cagent. It currently does not let you run your own Docker containers. So naturally, I went down the rabbit hole to see if I could reverse engineer the underlying microVM API in order to run any code I’d like inside of sandboxes. The /vm HTTP API: Creating a VM the-vm-http-api-creating-a-vm Docker’s sandboxd daemon manages all of the virtual machines and listens on ~/.docker/sandboxes/sandboxd.sock . It provides three endpoints: GET /vm : List all VMs POST /vm : Create a VM DELETE /vm/{vm name} : Destroy a VM We’ll create a VM with: curl -X POST --unix-socket ~/.docker/sandboxes/sandboxd.sock \ http://localhost/vm \ -H "Content-Type: application/json" \ -d '{"agent name": "my-sandbox", "workspace dir": "/path/to/project"}' And we get the response: { "vm id": "abc123", "vm config": { "socketPath": "/Users/you/.docker/sandboxes/vm/my-sandbox-vm/docker.sock", "fileSharingDirectories": "/path/to/project" , "stateDir": "/Users/you/.docker/sandboxes/vm/my-sandbox-vm" }, "ca cert path": "/Users/you/.docker/sandboxes/vm/my-sandbox-vm/proxy cacerts/proxy-ca.crt" } The VM name follows the pattern {agent name}-vm . socketPath is your per-VM Docker daemon, which we’ll use in the next step. Talking To The microVM’s Docker Daemon talking-to-the-micro-vms-docker-daemon Normally all containers share /var/run/docker.sock . Anyone with socket access can see and control every other container. Sandboxes flip this. Each microVM gets its own Docker daemon at ~/.docker/sandboxes/vm/