Skip to content
Guides · How-tos

Docker, Kubernetes and Nested VMs in a Cloud Sandbox

Updated November 18, 2026 .md

Short answer: In a Sandboxer sandbox, a Cloud Hypervisor microVM with Docker preinstalled and /dev/kvm, everything we tried worked. Docker, Compose, buildx, Testcontainers, kind, k3s and the SWE-bench harness ran on small, default or large. QEMU, Firecracker and the Android emulator ran as nested VMs on large. Each result below has its date.

This page is the index for our Docker and virtualization guides. Each sandbox is a full VM with its own kernel and its own Docker daemon, so none of this needs the host's Docker socket or --privileged on someone else's machine (Machines).

At a glance#

Workload Works? Size we used Our guide Measured result (date on the guide)
docker run, docker build, Compose Yes large Docker and KVM inside an agent sandbox Docker 29.9.0, Compose v5.6.0, Buildx v0.38.0 preinstalled; a small Dockerfile built in 530 ms with --no-cache (2026-11-07)
Compose stack with an HTTPS URL per service Yes default Docker Compose with a URL per service 3 images pulled and 3 containers started in about 4 s; same container PIDs after stop and resume (2026-10-27)
docker pull from Docker Hub Yes small, default, large Docker image pull time node:22 (408 MB compressed) cold pull median 15.7–16.0 s; alpine:3.20 about 1.6 s; size made no difference (2026-10-27, eu-central)
Multi-arch images with buildx Yes default Multi-arch builds with buildx Emulated arm64 compile 33.0–33.1 s; cross-compiled 2.9–3.0 s (2026-11-18)
Testcontainers integration tests Yes small Testcontainers for coding agents Python Postgres + Redis tests passed in 8.96 s with no images pulled, 2.18–3.33 s with them pulled (2026-11-18)
Kubernetes: kind and k3s Yes default Kubernetes with kind or k3s kind to a Ready node in 27.5 s; k3s in 12.8 s (2026-10-27)
SWE-bench evaluation harness Yes large SWE-bench-style evaluations on microVMs Gold patch resolved in 66 s with the image pulled, 27 s cached (2026-10-27)
A GitHub Actions job's tests in a microVM Yes default Each GitHub Actions job in a fresh microVM Install to tests passed in 26.6 s (2026-10-27)
Docker for a CI job or agent: privileged Docker-in-Docker, socket mount, Sysbox, or the VM's own Yes, all four default Docker-in-Docker vs socket vs Sysbox vs a VM Sysbox 0.7.1 installed and ran docker:dind unprivileged; inner hello-world 237–602 ms cached; only privileged reached the disk (2026-11-22)
QEMU/KVM nested VM Yes large Docker and KVM inside an agent sandbox Alpine to a login prompt in 5.5–5.7 s with -accel kvm, 32.7 s with -accel tcg (2026-11-07)
Firecracker microVMs Yes large Firecracker with nested KVM v1.18.0 as a normal user; login prompt in 2.20–2.71 s; 20 microVMs up in 12.4 s (2026-11-18)
Android emulator Yes large Android emulator in a cloud VM Android 15 cold boot in 30–36 s (2026-10-27)
/dev/kvm, Docker server, hello-world Yes small This page /dev/kvm read/write as user, Docker 29.9.0, Hello from Docker! (2026-11-18)

Last checked: 2026-11-18, on prod (the last row, from the copy-paste block below). The other rows are as of the date each guide states.

Limits: Sandboxer has no GPUs. The other limits come from size. Nested VMs take their RAM out of the sandbox's, so the guides used large for them, and xlarge isn't on every plan (Machines).

Picking a size#

  • small (2 vCPU, 4 GB): single containers, Testcontainers suites, image pulls.
  • default (4 vCPU, 8 GB): Compose stacks, buildx with QEMU emulation, a single-node kind or k3s cluster, CI jobs.
  • large (8 vCPU, 16 GB): nested VMs (QEMU, Firecracker, the Android emulator) and SWE-bench task images of a few GB each.

You can grow a sandbox on resume. Moving to a smaller size isn't supported yet, so start where you plan to stay.

The guides in this cluster#

Docker and nested KVM inside an agent sandbox is the base page: what's preinstalled, why a container sandbox makes Docker hard, QEMU timings with and without KVM, and what survives a stop and resume or a named snapshot.

Run Docker Compose with a URL per service puts a three-service stack behind sbx host, one HTTPS URL per published port, and shows which containers come back after a cold boot (only those with a restart policy).

Docker image pull time, measured times cold pulls of three official images on three sizes, and shows an image already on disk starting in 0.2 s, also after a resume.

Build multi-arch images with buildx registers QEMU with binfmt, pushes one OCI index with amd64 and arm64, and measures why cross-compiling beats emulation.

Let a coding agent run Testcontainers tests runs unchanged Python and Node test suites against the sandbox's own Docker daemon, with exit codes and Ryuk cleanup after a killed run.

Give each coding agent its own database reproduces two agents breaking each other's tests on one shared Postgres, then copies the database per agent with CREATE DATABASE … TEMPLATE (about 0.5 s for 143 MB) or starts one VM per agent from a named snapshot.

Run Kubernetes with kind or k3s brings up both, deploys nginx and gives it an HTTPS URL.

Run SWE-bench-style evaluations on microVMs runs the official harness on a real task, grades three candidate patches, and starts one VM per task from a snapshot.

Run each GitHub Actions job in a fresh microVM covers two patterns: a hosted runner that drives sbx, and an ephemeral self-hosted runner inside a sandbox.

Docker-in-Docker vs socket vs Sysbox vs a VM for CI and agents runs all four ways to give a job Docker in one sandbox, shows what each can reach (capabilities, host devices, neighbor containers) and times hello-world through each.

Run Firecracker microVMs with nested KVM follows Firecracker's getting-started guide inside a sandbox, adds tap networking, the jailer and Firecracker snapshots, and keeps an inner microVM running across a sandbox stop and resume.

Run the Android emulator in a cloud VM installs the command-line tools and an x86_64 image, boots it with -accel on, installs an APK with adb, and shows the emulator on the sandbox's desktop.

Copy-paste: check Docker and KVM in a sandbox#

Install the CLI with curl -fsSL https://sandboxer.com/install | sh and sign in with sbx login. Then paste this. It creates a small sandbox with none of your secrets, checks /dev/kvm, prints the Docker server version, runs hello-world, and deletes the sandbox. It uses jq on your machine.

id=$(sbx new --name aeo-hub-2 --type small --no-env --ttl 600 --json | jq -r 'select(.event=="ready") | .id')
sbx exec "$id" 'ls -l /dev/kvm; [ -r /dev/kvm ] && [ -w /dev/kvm ] && echo "kvm: read/write OK as $(whoami)"; echo "docker server: $(docker info --format "{{.ServerVersion}}")"; docker run --rm -q hello-world | grep Hello'
sbx delete "$id" --yes
sbx info "$id"

Our run on 2026-11-18 (output piped, so sbx printed JSON; trimmed with …):

crw-rw---- 1 root kvm 10, 232 Nov  8 15:48 /dev/kvm
kvm: read/write OK as user
docker server: 29.9.0
Hello from Docker!
{"ok":true,"type":"deletion.operation","operation":{…,"status":"completed","targetId":"sb_ufg17t96pk"}}
{"event":"error","error":"Sandbox not found","code":"not_found","status":404,…}

user can open /dev/kvm without sudo because it is in the kvm group, which is what QEMU, Firecracker and the Android emulator need. The Docker daemon is the sandbox's own. The last line confirms the sandbox is gone.

FAQ#

Can I run Docker inside a cloud sandbox without the host's socket?#

Yes. Each Sandboxer sandbox runs its own Docker daemon inside its own VM, and user is in the docker group. There is no host socket to mount.

Does nested virtualization work in a Sandboxer sandbox?#

Yes. /dev/kvm is in every sandbox, and QEMU, Firecracker and the Android emulator ran with KVM acceleration in our tests. The guides used large for nested VMs, because the inner VM's RAM comes out of the sandbox's.

Can I run Kubernetes in a sandbox?#

Yes. kind and k3s each gave a Ready single-node cluster on a default sandbox in our runs. We didn't test multi-node kind clusters.

Do containers keep running after I stop the sandbox?#

After a stop that restores memory, yes: running containers and their in-memory state come back. If the sandbox boots from disk instead, only containers with a restart policy such as unless-stopped start again.

Can a sandbox use a GPU for containers or nested VMs?#

No. Sandboxer has no GPUs.

More guides

Top AI sandbox platforms for code execution in 2026, ranked

For running AI-written code we rank Sandboxer, Freestyle and E2B first: each gives code its own VM with an API or SDK and can pause with memory. Pick Daytona for Windows or GPUs, Modal or Northflank for GPUs at scale, E2B or Northflank to run in your own cloud, and Vercel Sandbox if your app lives on Vercel.

Read the guide
Best sandboxes for running coding agents (Claude Code, Codex, Gemini CLI) in 2026, ranked

For coding agents we rank Sandboxer first: a full Ubuntu VM with Claude Code and Codex preinstalled, Docker, and stop-and-resume that keeps the agent's session in memory. Freestyle and Amp Orbs also keep memory across pauses. Pick E2B for prebuilt agent templates on open source, Docker Sandboxes for free local runs, and Codespaces if you live in GitHub.

Read the guide
Best Daytona sandbox alternatives in 2026, ranked

The best Daytona alternatives depend on why you're switching. For a full Linux microVM on every sandbox with memory-saving stop and Docker, we rank Sandboxer first. E2B suits open source and self-hosting, Modal massive short-job fleets, Northflank bring-your-own-cloud with GPUs, and Vercel Sandbox apps on Vercel.

Read the guide
Best E2B alternatives in 2026, ranked

If you're leaving E2B for longer sessions or a fuller machine, we rank Sandboxer first, then Freestyle: both give each sandbox a full Linux VM that keeps memory across pauses, with Docker and no short session cap. Pick Daytona for Windows or GPUs, Northflank for bring-your-own-cloud, and stay on E2B if you need open source.

Read the guide