Docker starts a container process. Firecracker first boots a small virtual machine with its own kernel. Where each draws the boundary decides which one to use.
What a container is
A container is an ordinary Linux process with a restricted view of the machine. Namespaces give it its own file tree, process list and network. Cgroups limit its CPU and memory. Underneath, it makes system calls straight into the host kernel, the same kernel every other container on the server uses.
That shared kernel is the boundary. Code that exploits a bug in the host kernel can escape the container. For code you wrote or reviewed, that is a fine trade. For code you did not, such as a pull request from a stranger or a script an AI model just produced, it is the one boundary between that code and everything else on the server.
What a microVM is
Firecracker is a virtual machine monitor built for short-lived workloads. Each microVM gets its own small Linux kernel and a handful of virtual devices: a disk, a network card if you give it one, and a socket to talk to the host. The program inside makes system calls into its own kernel. To reach the host it has to break out of the virtual machine through hardware virtualization (KVM), a much smaller surface than the full system call interface.
Firecracker also runs under a jailer, which places each VM process in its own chroot, namespaces and cgroup, and drops its privileges. Getting out of the VM still lands an attacker in a locked down process.
What it costs
We measured Firecracker v1.17 on its own, without FlatRun, with a 6.1 guest kernel on one workstation (Intel Core Ultra 9 185H, Linux 7.0), at 1 vCPU and 256 MiB unless stated:
| Measurement | Result |
|---|---|
| Cold boot until the guest runs its first program | 0.62 to 0.69 s of guest time, 10 runs |
Cold boot, run /bin/true, shut down | 0.81 s wall time, 5 runs |
| Host memory of an idle VM | 48 MiB at 256 MiB configured, 61 MiB at 1024 MiB |
A container skips that boot and has no guest kernel in memory. Compare the boot time with how long your workload runs. In FlatRun, the first run of an image also builds its disk file, and later runs reuse it.
The bigger costs are operational. Firecracker needs a Linux host with /dev/kvm, which rules out most cloud VMs unless they offer nested virtualization. It needs a guest kernel, and images have to be turned into disk files, since a VM cannot read Docker’s layers directly.
When to use each
Use a container when the code is yours or reviewed: your own builds, your own services, jobs you wrote.
Use a microVM when you did not write the code and cannot read it first: pull requests from outside contributors, user submissions, plugins, and anything an AI agent generates and wants to execute.
Both, behind one API
FlatRun sandboxes take a runtime field: docker or firecracker. The rest of the request is the same: an image, a command, a timeout, whether the network is on, and the files to keep. Once Firecracker is set up on the host, changing that field moves a workload to a microVM.
{
"runtime": "firecracker",
"image": "python:3.12-alpine",
"command": ["python", "-c", "print(sum(range(10**6)))"],
"timeout_seconds": 60
}
FlatRun turns the image into a cached ext4 disk, gives each run its own copy, starts it with no network unless asked, and removes the VM when the run ends. The setup guide lists what the host needs.