docker:dind image on a flat root disk, starts Docker inside the sandbox, waits for it to be ready, and then opens an interactive shell. From there, Docker commands run against the daemon inside the sandbox, not your host.
Run Docker in a sandbox
1
Start Docker
- Starts the
docker:dindimage in a sandbox nameddocker-demo. - Gives the sandbox a 10 GiB flat root disk for the image, Docker data, and build cache.
- Runs the inline
startscript as the entrypoint. The script starts Docker, waits until it is ready, and then opens a shell.
2
Run a container
From the sandbox shell, run a nested Ubuntu container:You are now in a container running inside Docker, which is itself running inside the microsandbox VM. Exit the Ubuntu container with
exit to return to the docker-demo sandbox shell.You can also verify the daemon with a short non-interactive command:3
Clean up
Exit the sandbox shell:Back on the host, remove the sandbox:Removing the sandbox also removes the nested daemon’s images, containers, and build cache.
Details
The flat root gives Docker a direct ext4 filesystem. That matters because Docker’s default storage driver uses overlay layers; a normal managed root would place those layers on top of the sandbox’s own OverlayFS.Notes
- Memory. The example uses
--memory 2G. Increase it for larger builds or memory-hungry containers. - Not the same as Sandbox in Docker. That example covers the opposite direction.