Nested DockerPlatforms & Hypervisors · 4 min read
Run Nested dockerd & Testcontainers Safely Inside MicroVM Sandboxes
Mounting /var/run/docker.sock gives an agent instant root on your laptop. Inside Kagex, agents run a dedicated dockerd inside the guest kernel — zero host exposure.
- Socket safety
- Zero host /var/run/docker.sock exposure
- Daemon script
- infra/image/start-docker + wrapper
- Reset time
- Disposable on sandbox rm / restore
Run Docker workflows inside an ephemeral sandbox
ID=$(sandboxctl create -w ~/code/service-api | awk '{print $1}')
sandboxctl exec "$ID" -- 'docker compose -f compose.test.yml up --abort-on-container-exit'
sandboxctl rm "$ID"Key Engineering Points · MicroVM Kernel & Compute Isolation
All 10 key points →- 1Every Kagex sandbox boots a dedicated single-tenant Ubuntu 24.04 Linux kernel rather than sharing the host OS kernel.
- 2macOS 14+ (Apple Silicon) runs natively via Apple Virtualization.framework (Code-Hex/vz/v3) with rootless ad-hoc entitlements in infra/vz.entitlements.
- 3Linux amd64 and arm64 hosts run Firecracker v1.12.1 over /dev/kvm with per-VM Linux network namespaces and nftables packet filters.
- 4Windows 10 (19041+) and Windows 11 (x64/arm64, Home/Pro/Enterprise) supervise Firecracker KVM inside WSL2 without requiring Hyper-V Pro or Admin privileges.
- 5Guest base kernels are sha256-verified via infra/scripts/fetch-kernel.sh before registration into _out/images/vmlinux-<arch>.
- 6Every microVM boots from an immutable Ubuntu 24.04 ext4 rootfs built reproducibly with Docker or native debootstrap.
Why /var/run/docker.sock Breaks Security
Any process able to talk to the host Docker daemon can bind-mount / and become host root in seconds. Kagex boots dockerd cleanly inside a disposable guest VM kernel instead.
Disposable Sidecars & Databases
Agents can spin up PostgreSQL, Redis, or Playwright containers during test suites knowing container state evaporates cleanly when the microVM exits.
Inspect this architecture live in 3D
Step through MCP ingress, Ghost Secrets, CoW blades, and run sandboxctl commands interactively in your browser.
Frequently Asked Questions
Yes. Both Apple Virtualization.framework and Linux/WSL2 Firecracker guests boot full Ubuntu kernels with dockerd support.
#nested docker microVM#safe docker.sock alternative AI agent#Testcontainers inside microVM#isolated Docker builds Firecracker#Docker in Virtualization.framework