Add Docker Sandboxes (sbx) as a new SandboxProvider (docker-sbx)
Docker continues to evolve their Docker Sandboxes feature, which runs AI agents in microVM-isolated environments via the sbx CLI. This proposal is to add it as a new provider — docker-sbx — following the same pattern as the existing docker and podman providers.
Why microVMs over regular containers
The docker and podman providers share the host kernel. For an agentic coding tool, this matters: agents regularly build images, run test containers, and execute arbitrary generated code. Docker Sandboxes addresses this with microVM-based isolation:
- Each sandbox gets its own kernel, filesystem, and Docker daemon — container escapes and kernel exploits can't reach the host
- Agents can run docker build/docker run inside the sandbox natively — no --privileged flag or DinD hacks needed
- Meaningfully stronger security posture for users running untrusted or AI-generated code
Custom sandbox images
Just like the existing docker/podman providers scaffold a Dockerfile and expose sandcastle docker build-image, docker-sbx would support custom sandbox templates. Users extend the official base image with their toolchain:
FROM docker/sandbox-templates:claude-code-docker
RUN apt-get install -y my-build-depsThe sandcastle docker-sbx build-image command would build and push to a registry (required since sbx pulls from OCI registries, not local storage), then sbx run -t claude would use it. This gives the same "optimize your starting environment for your codebase" workflow that Dockerfile-based providers already offer.
ToS clarity (re: #191)
The sbx CLI handles Claude Code authentication and subscription activation itself — Sandcastle wouldn't need to provide guidance on auth at all. Docker is an official partner running Claude Code inside their product with Anthropic's knowledge. This sidesteps the ambiguity in #191 entirely: the maintainer delegates the compliance surface to Docker rather than owning it.
Implementation scope
This would be a bind-mount provider modeled on src/sandboxes/docker.ts:
- New file: src/sandboxes/docker-sbx.ts (~200–300 lines)
- Entry in SANDBOX_PROVIDER_REGISTRY in src/InitService.ts
- CLI subcommand: sandcastle docker-sbx build-image (build + push to registry)
- Template: Dockerfile extending docker/sandbox-templates:claude-code-docker
The provider abstraction already handles everything else (worktrees, env merging, lifecycle, streaming).
Source: mattpocock/sandcastle