Sandboxer
Should a CI job get Docker through Docker-in-Docker, the socket, Sysbox or a VM?
For untrusted code, such as an AI agent's commands or pull requests from strangers, give each job its own VM. Privileged Docker-in-Docker hands the job every capability and the host's disks, and a mounted Docker socket lets it control every container on the host. Sysbox runs Docker-in-Docker without privileged mode, but its own docs say it isolates less than a VM.
Updated November 24, 2026
What did the comparison find?
Sandboxer ran all four in one sandbox for its guide Docker-in-Docker vs socket vs Sysbox vs a VM, with the VM playing the host and each job a container on it:
| Setup | What the job could reach | Use it for |
|---|---|---|
| Privileged Docker-in-Docker | Every capability as real root, and the host's disk: the test mounted it and read files | Your own trusted builds, if nothing else works |
| Host socket mount | The host's own Docker daemon: it listed both neighbouring jobs and stopped one | Trusted builds on a host with nothing else on it |
| Sysbox Docker-in-Docker | Root only inside a user namespace, and no host disk | Trusted or semi-trusted jobs that need Docker without privileged mode |
| A VM per job | Only its own VM, with its own kernel and Docker daemon | Untrusted code: agents, forks, pull requests from strangers |
Is a VM much slower?
No. In the guide's runs on November 22, 2026, a second run of Docker's hello-world container took 237 to 268 milliseconds in the VM and 306 to 602 milliseconds with the other three. The guide's point is that over a CI job lasting minutes, start time won't decide this; the isolation boundary will.
What do the projects themselves say?
- Privileged mode: Docker's own reference says a privileged container "is not a securely sandboxed process" and can get a root shell on the host.
- The Docker socket: Docker's security docs say only trusted users should control the daemon, because it can start a container with the host's root filesystem mounted.
- Sysbox: its README says it runs Docker-in-Docker without privileged containers or the host socket, but "does not (yet) provide the same level of isolation as VM-based alternatives".
How does a VM per job work on Sandboxer?
Each Sandboxer sandbox is a microVM with its own kernel and its own Docker daemon, so a job runs Docker as it would on any Linux machine, with no privileged flag and no shared socket. CI creates one sandbox per job, runs the tests and deletes it. See CI and testing in fresh microVMs and root, Docker and nested KVM. For why each sandbox is a VM at all, see microVMs vs containers.
Frequently asked questions
Is Docker-in-Docker safe for untrusted code?
Not in privileged mode: the job gets every capability and the host's devices. For untrusted code, give each job its own VM.
Is mounting the Docker socket into a job safe?
Only for trusted jobs on a host with nothing else on it. In Sandboxer's test, a job with the socket listed and stopped its neighbours' containers.
Does Sysbox make Docker-in-Docker as safe as a VM?
No. Sysbox's own README says it doesn't yet provide the same level of isolation as VM-based alternatives.
Does a Sandboxer job need --privileged to run Docker?
No. Each sandbox is a VM with its own Docker daemon, so Docker works without privileged mode.