Use Docker for trusted application deployment where performance is critical. Use BoxLite when running untrusted code (AI agents, user submissions) where security isolation is non-negotiable. Docker containers share the host kernel; BoxLite sandboxes each have their own kernel via hardware virtualization.
| Feature | BoxLite | Docker |
|---|---|---|
| Isolation Type | Hardware VM (micro-VM) | Kernel namespaces |
| Kernel | Separate per sandbox | Shared with host |
| Container Escape Risk | Near zero (VM boundary) | Possible (CVEs exist) |
| Boot Time | <1 second | <100ms |
| Memory Overhead | ~50-100MB per VM | Minimal |
| Daemon Required | No | Yes (dockerd) |
| Root Required | No (KVM access only) | Typically yes |
| OCI Image Support | Full | Native |
| Embeddable | Yes (library) | No (CLI/API) |
The core difference is where isolation happens:
This means a vulnerability in Docker's isolation (a "container escape") could give an attacker access to the host system. With BoxLite, even if an attacker compromises the sandbox kernel, they're still trapped inside a VM with no path to the host.
Container escapes are real. Here are some notable Docker/container CVEs:
If you're running trusted code you control, these risks are manageable. But for AI-generated code or user-submitted code, any container escape could be catastrophic.
Yes! A common pattern is:
BoxLite can run inside a Docker container, providing defense-in-depth: even if BoxLite had a vulnerability, the attacker would still be inside a Docker container.
Here's how you'd run Python code in each:
import subprocess
# Requires Docker daemon running
result = subprocess.run([
"docker", "run", "--rm",
"python:slim",
"python", "-c", "print('Hello')"
], capture_output=True, text=True)
print(result.stdout) import boxlite
# No daemon, just a library
async with boxlite.SimpleBox("python:slim") as box:
result = await box.exec("python", "-c", "print('Hello')")
print(result.stdout) Docker revolutionized deployment by making containers practical. BoxLite builds on that foundation by bringing hardware-level isolation to the same workflow—same OCI images, similar API, but with a VM boundary instead of kernel namespaces.
The rule is simple: Trust your code? Use Docker. Don't trust it? Use BoxLite.
Get started with secure sandboxing in minutes.