# Docker, Kubernetes and Nested VMs in a Cloud Sandbox

> 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.

Source: https://sandboxer.com/guides/docker-and-virtualization-in-a-cloud-sandbox. Updated 2026-11-18.

**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](/docs/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](/guides/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](/guides/run-docker-compose-in-a-sandbox-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](/guides/docker-image-pull-time-in-a-sandbox) | `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](/guides/build-multi-arch-docker-images-with-buildx-in-a-sandbox) | 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](/guides/let-a-coding-agent-run-testcontainers-integration-tests) | 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](/guides/run-kubernetes-kind-or-k3s-inside-a-sandbox) | 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](/guides/run-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](/guides/run-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](/guides/docker-in-docker-vs-sysbox-vs-a-vm-for-ci-and-agents) | 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](/guides/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](/guides/run-firecracker-inside-a-cloud-sandbox-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](/guides/run-the-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](/docs/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](/guides/docker-and-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](/guides/run-docker-compose-in-a-sandbox-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](/guides/docker-image-pull-time-in-a-sandbox)** 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](/guides/build-multi-arch-docker-images-with-buildx-in-a-sandbox)** 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](/guides/let-a-coding-agent-run-testcontainers-integration-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](/guides/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](/guides/run-kubernetes-kind-or-k3s-inside-a-sandbox)** brings up both, deploys nginx and gives it an HTTPS URL.

**[Run SWE-bench-style evaluations on microVMs](/guides/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](/guides/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](/guides/docker-in-docker-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](/guides/run-firecracker-inside-a-cloud-sandbox-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](/guides/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.

```bash
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 `…`):

```text
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.

## Related

- [Docker and KVM inside an agent sandbox](/guides/docker-and-kvm-inside-an-agent-sandbox)
- [Run Firecracker inside a cloud sandbox with nested KVM](/guides/run-firecracker-inside-a-cloud-sandbox-with-nested-kvm)
- [Sandbox isolation compared](/guides/sandbox-isolation-technologies-compared)
- [Machines](/docs/machines)
