# Sandbox Isolation Compared: Containers, gVisor, Kata, MicroVMs, Wasm

> Containers share the host's kernel. gVisor puts a user-space kernel in front of it. Kata Containers, Firecracker and Cloud Hypervisor give each workload its own kernel behind KVM. Wasm runs code that can only call what its host imports. For untrusted code that needs a whole Linux machine, use a microVM.

Source: https://sandboxer.com/guides/sandbox-isolation-technologies-compared. Updated 2026-11-18.

**Short answer:** Containers share the host's kernel. gVisor puts a user-space kernel in front of it. Kata Containers, Firecracker and Cloud Hypervisor give each workload its own kernel behind KVM. Wasm runs code that can only call what its host imports. For untrusted code that needs a whole Linux machine, use a microVM.

This page is the index for our isolation guides. Each row and paragraph below links the page that has the detail, the sources and the commands we ran.

*Disclosure: every Sandboxer sandbox is a Cloud Hypervisor microVM. The other projects' facts come from their own docs, linked inline.*

## At a glance

| | Container (runc) | gVisor | Kata Containers | Firecracker | Cloud Hypervisor | Wasm runtime |
| - | - | - | - | - | - | - |
| What isolates the code | Linux namespaces and cgroups | A user-space "application kernel" (the Sentry) that handles system calls | A lightweight VM per pod, on a hypervisor you choose | A minimal VMM on KVM | A general-purpose cloud VMM on KVM or MSHV | The Wasm sandbox: memory isolation and imported functions only |
| Kernel the code talks to | The host's | gVisor's own, in user space | The guest's own | The guest's own | The guest's own | None; it calls host functions it was given |
| Needs KVM on the host | No | No (`systrap` platform) | Yes: bare metal or nested virtualization | Yes, `/dev/kvm` | Yes (or MSHV) | No |
| Linux compatibility | Full | "Only implements a subset of the Linux syscall ABI" | Full guest kernel | Full guest kernel; Linux and OSv guests | Full guest kernel; Linux and UEFI Windows | Not Linux: code compiled to Wasm, with WASI for files and more |
| Docker inside | Only with `--privileged` or a mounted socket | Supported with `runsc` flags | Not covered in the docs we read | Whatever your guest image has | Whatever your guest image has | No |
| Nested VMs inside | No | "Usage of KVM from within the sandbox is not supported" | Not covered in the docs we read | Not documented | Yes, `--cpus nested=on` | No |
| Our guide | [Container vs microVM](/guides/container-vs-microvm-for-untrusted-code) | [gVisor vs Kata vs Firecracker](/guides/gvisor-vs-kata-vs-firecracker-for-untrusted-code) | [gVisor vs Kata vs Firecracker](/guides/gvisor-vs-kata-vs-firecracker-for-untrusted-code) | [Firecracker vs Cloud Hypervisor](/guides/firecracker-vs-cloud-hypervisor) | [Firecracker vs Cloud Hypervisor](/guides/firecracker-vs-cloud-hypervisor) | [Wasm vs container vs microVM](/guides/wasm-vs-container-vs-microvm-for-llm-generated-code) |

Last checked: 2026-11-18, on prod (the copy-paste block below) and in each project's docs.

Sources: [Docker security](https://docs.docker.com/engine/security/), [Docker post-install](https://docs.docker.com/engine/install/linux-postinstall/), [What is gVisor?](https://gvisor.dev/docs/), [gVisor compatibility](https://gvisor.dev/docs/user_guide/compatibility/), [gVisor platforms](https://gvisor.dev/docs/architecture_guide/platforms/), [Kata on Kubernetes](https://github.com/kata-containers/kata-containers/blob/main/docs/design/architecture/kubernetes.md), [Kata install](https://github.com/kata-containers/kata-containers/blob/main/docs/install/README.md), [Firecracker README](https://github.com/firecracker-microvm/firecracker/blob/main/README.md), [Cloud Hypervisor README](https://github.com/cloud-hypervisor/cloud-hypervisor/blob/main/README.md), [Cloud Hypervisor CPU (nested)](https://github.com/cloud-hypervisor/cloud-hypervisor/blob/main/docs/cpu.md), [WebAssembly security](https://webassembly.org/docs/security/), [Wasmtime security](https://docs.wasmtime.dev/security.html).

On Wasm: the WebAssembly docs say each module "executes within a sandboxed environment separated from the host runtime" and "can't escape the sandbox without going through appropriate APIs". Wasmtime adds that Wasm "must import all functionality", and its WASI file access is capability-based, so code reaches only the directories it was given. That makes Wasm a good fit for a plugin or a function, and a poor fit for code that expects `apt`, a shell or Docker.

## Which should I use?

- **The code is your own or reviewed, and speed matters most:** a plain container. Everything shares one kernel, so treat it as a packaging tool, not a security boundary for untrusted code.
- **Untrusted scripts at high density on Kubernetes nodes without nested virtualization:** gVisor. It needs no KVM, but check that your code avoids what it doesn't implement (`io_uring` by default, perf counters, KVM).
- **Per-pod VM isolation without leaving Kubernetes:** Kata Containers, on bare metal or nodes with nested virtualization.
- **You're building your own sandbox or functions platform with many short VMs:** Firecracker. You own the kernel, rootfs, networking and jailer.
- **Longer-lived VMs that need more of a real machine** (nested KVM, device passthrough, shared folders, CPU hotplug, Windows guests): Cloud Hypervisor.
- **A plugin or a pure function compiled to Wasm, with no OS access:** a Wasm runtime with only the host functions it needs.
- **Untrusted or AI-generated code that needs Docker, systemd, root or a nested VM, and you don't want to run nodes:** a hosted microVM. A Sandboxer sandbox is one: a Cloud Hypervisor microVM with its own kernel, Docker and `/dev/kvm` ([Machines](/docs/machines)).

Whatever you pick, the boundary is one layer. Secrets inside the sandbox, its outbound network and what you do with its output are still yours to handle.

## The guides in this cluster

**[Container vs microVM for untrusted code](/guides/container-vs-microvm-for-untrusted-code)** is the first decision. In one `default` sandbox on 2026-11-08 it shows a container reporting the VM's kernel (`6.18.56-sandboxer`), a `--privileged` container getting every capability and the disk device (154 device nodes against 15), and a mounted Docker socket listing the other containers.

**[gVisor vs Kata Containers vs Firecracker](/guides/gvisor-vs-kata-vs-firecracker-for-untrusted-code)** compares the three projects from their docs: boundary, KVM needs, Kubernetes support and what runs inside. Its syscall probe (2026-10-31) shows that a full guest kernel allows `io_uring`, `perf_event_open` and `KVM_CREATE_VM`, the calls gVisor disables or leaves out.

**[Firecracker vs Cloud Hypervisor](/guides/firecracker-vs-cloud-hypervisor)** is the VMM choice: Firecracker's minimal device model against Cloud Hypervisor's VFIO, virtio-fs, CPU hotplug, nested virtualization and live migration. On 2026-11-09 it read the virtio-pci devices of a sandbox and showed a stop and resume keeping a running process.

**[What is a microVM?](/guides/what-is-a-microvm)** defines the term from the inside of one `small` sandbox (2026-10-27): KVM, a Cloud Hypervisor DMI vendor, a PCI bus with only a host bridge and five virtio devices, and a kernel up in 346 ms.

**[Run Firecracker inside a cloud sandbox with nested KVM](/guides/run-firecracker-inside-a-cloud-sandbox-with-nested-kvm)** runs the official Firecracker v1.18.0 binary as a normal user in a `large` sandbox. On 2026-11-18 guests reached a login prompt in 2.20–2.71 s, and 20 microVMs were up in 12.4 s.

**[What can reach a sandbox, and what can it reach?](/guides/what-can-reach-a-sandbox-and-what-it-can-reach)** covers the network side of the boundary, checked on two `small` sandboxes on 2026-10-27: other sandboxes, private ranges and port 25 blocked, outbound open, and how to restrict it with ufw.

**[WebAssembly vs container vs microVM for LLM-generated code](/guides/wasm-vs-container-vs-microvm-for-llm-generated-code)** runs one Python script under Pyodide, wasmtime with a CPython WASI build, `python:3.12-slim` and the VM itself in one `default` sandbox (2026-11-20), and shows what each can read, connect to and `pip install`.

## Copy-paste: check the boundary of 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, prints its kernel, its virtualization type, the VMM and the kernel a Docker container inside it sees, and deletes it. It uses `jq` on your machine.

```bash
id=$(sbx new --name aeo-hub-1 --type small --no-env --ttl 600 --json | jq -r 'select(.event=="ready") | .id')
sbx exec "$id" 'echo "VM kernel:        $(uname -r)"; echo "virt type:        $(systemd-detect-virt)"; echo "VMM:              $(cat /sys/class/dmi/id/sys_vendor)"; echo "container kernel: $(docker run --rm -q alpine:3.20 uname -r)"'
sbx delete "$id" --yes
sbx info "$id"
```

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

```text
VM kernel:        6.18.56-sandboxer
virt type:        kvm
VMM:              Cloud Hypervisor
container kernel: 6.18.56-sandboxer
{"ok":true,"type":"deletion.operation","operation":{…,"status":"completed","targetId":"sb_na42crtn6m"}}
{"event":"error","error":"Sandbox not found","code":"not_found","status":404,…}
```

The container reports the VM's kernel because a container has no kernel of its own. On a laptop or server that line would be the machine's own kernel. Here it is the sandbox's, behind KVM. The last line confirms the sandbox is gone.

## FAQ

### Is a container enough to isolate AI-generated code?

Not on its own. A container shares the host's kernel, and Docker documents that its daemon runs as root and the `docker` group is root-equivalent. Use a VM boundary, or gVisor, for code you haven't reviewed.

### What is the difference between gVisor and a microVM?

gVisor intercepts system calls in a user-space kernel and needs no KVM, but implements only part of Linux. A microVM gives the code a real guest kernel behind hardware virtualization, so Docker, systemd and nested VMs work inside.

### Is Kata Containers the same as Firecracker?

No. Kata Containers is a container runtime that starts a VM per pod. Firecracker is one of the hypervisors it can use, alongside QEMU, Cloud Hypervisor and others.

### Can WebAssembly replace a VM for untrusted code?

For code compiled to Wasm that needs only what the host gives it, yes, and it needs no KVM. It can't run a Linux toolchain, a shell or Docker, so code that expects a whole machine still needs a VM.

### Which isolation does Sandboxer use?

Each sandbox is a Cloud Hypervisor microVM with its own kernel. Docker containers inside it share that VM's kernel, not the physical host's, as the copy-paste block shows.

## Related

- [Container vs microVM for untrusted code](/guides/container-vs-microvm-for-untrusted-code)
- [gVisor vs Kata Containers vs Firecracker](/guides/gvisor-vs-kata-vs-firecracker-for-untrusted-code)
- [Docker, Kubernetes and nested VMs in a cloud sandbox](/guides/docker-and-virtualization-in-a-cloud-sandbox)
- [Security](/docs/security)
