Documentation Index
Fetch the complete documentation index at: https://docs.microsandbox.dev/llms.txt
Use this file to discover all available pages before exploring further.
This recipe gives you a complete, throwaway Docker environment inside a microsandbox VM. It is useful for sandboxed builds, isolating agent workflows that need their own Docker, or any experiment you don’t want leaking onto the dev machine. The host’s Docker setup (if any) is left untouched.
docker:dind is a regular OCI image, so microsandbox can boot one inside a microVM. You boot the image into a shell, start dockerd, and from there every Docker command in that shell talks to the nested daemon rather than the host’s.
Storage needs one small workaround. The sandbox root is already an overlayfs mount, and Docker’s default storage driver also wants overlayfs for container layers. Stacking the two produces overlay-on-overlay mount errors. The fix is to point Docker’s data root at /tmp, which microsandbox already mounts as tmpfs.
Step 1: Create the helper script
Save this asstart-docker in the directory you’ll run msb from:
start-docker
Step 2: Boot the sandbox
--entrypoint sh replaces the image’s default DinD entrypoint with an interactive shell. --script-path makes start-docker available inside the sandbox at /.msb/scripts/start-docker, which is already on PATH.
Step 3: Start the daemon
From the sandbox shell, run the helper:ready, the daemon is running and the Docker client in the same shell is connected to it.
Step 4: Run something
Verify the daemon with hello-world:Ctrl-C stops the tail; heartbeat continues running in the background.
For a visual demo, run cmatrix in a nested Alpine container:
q exits.
Cleanup
Notes
- Tmpfs sizing.
/tmpis 1 GiB here. Increase--tmpfs /tmp:Nif you plan to pull larger images. - Named volumes don’t fix this. They are virtiofs-backed host directories, and Docker’s overlay snapshotter can’t use those for
upperdir/workdir. - Future work: disk-image-backed volumes. microsandbox already supports virtio-blk-mounted disk images at the runtime layer. Once that is exposed through
msb volume, Docker’s data root can sit on a real block device and survive sandbox removal. - Not the same as Sandbox in Docker. That recipe covers the opposite direction.