Add the docker-sbx provider - #11
Merged
Merged
Conversation
czpython
force-pushed
the
docker-sandbox-provider
branch
6 times, most recently
from
August 18, 2026 14:46
5c7c1d0 to
219048c
Compare
The provider runs each host as a Docker Sandboxes microVM. The template image starts sshd and does not need environment variables. The provider injects the SSH key and the caller environment with sbx exec. Then it publishes port 22 on a host port that the daemon selects. The provider sets supports_tailnet to False. The host machine owns the sbx installation, the login, and the daemon. A drukbox container connects through a socket mount and the DOCKER_SANDBOXES_API variable. The images/sbx/ directory contains the template.
czpython
force-pushed
the
docker-sandbox-provider
branch
from
August 18, 2026 14:49
219048c to
33c0290
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #8.
Summary
This change adds the
docker-sbxVM provider. The provider runs each host as a Docker Sandboxes microVM. Each microVM has its own kernel, its own filesystem, and its own Docker daemon. This gives more isolation than the localdockerprovider.Changes
src/providers/docker_sbx/contains the provider. TheSbxCLIclass starts thesbxcommand as an async subprocess. The settings use theDOCKER_SBX_prefix.images/sbx/contains the sandbox template. The template starts sshd and does not need environment variables. Thesbx createcommand cannot send environment variables.sbx exec. The script goes through stdin. Secrets do not go on the command line.DOCKER_SBX_ADVERTISE_HOSTaddress. The daemon selects a free host port.--cpusand--memory. Without these flags, the daemon gives one sandbox all host CPUs and half of the host memory.supports_tailnettoFalse. The service does not send a Tailscale setup script to this provider.docs/deploy.mdshows the host prerequisites and the container configuration. The host owns thesbxinstallation, the login, and the daemon. A drukbox container connects through a socket mount and theDOCKER_SANDBOXES_APIvariable.Review
An adversarial review found 10 problems. This PR fixes all of them:
supports_tailnettoFalse. A tailnet-mode service made a Tailscale key for each host and then lost it.authorized_keysfile empty at each start. A restart of a sandbox removed the SSH key.mkdirerror went around the provider error boundary. The host record stopped in a state that blocks deletion.ssh_usernamesetting had no effect.sbxcalls had no time limit. A blocked daemon stopped requests permanently. The limit is now 600 seconds.docs/networking.mddid not show the new provider.Verification
uv run ruff check: passuv run ruff format --check: passuv run pyright: 0 errorsuv run pytest: 377 tests passKnown limits
api-tests) did not run against a live deployment.ghcr.io/czpython/drukbox/sbx-sandbox:latestdoes not exist yet. Build and push the image before deployment.SERVICE_LABELtag. ThesbxCLI has no label option. Give each deployment its own daemon.