This Labspace shows how to run AI coding agents inside isolated Docker Sandboxes (sbx) and progressively harden what the agent produces using sbx kits and Docker Hardened Images (DHI).
The Labspace uses the host-backed ttyd provider from the Docker Labspace CLI plugin so sbx can create sandboxes with host access. The demo payload lives under project/.
By the end of this Labspace, you will have learned the following:
- How to run an AI coding agent (Claude) in an isolated Docker Sandbox microVM with its own daemon, filesystem, and network
- How sandbox network policy allows approved development endpoints while denying everything else
- What an sbx kit is: declarative, repeatable, shareable agent configuration (tools, credentials, network rules, files, startup commands, and guidance) defined in a single
spec.yaml - How attaching a container best-practices kit changes the agent's output compared to a plain sandbox
- How a DHI kit directs the agent to use Docker Hardened Images for both build and runtime stages
- How to keep registry credentials on the host using sbx custom secrets, so the real Docker PAT never enters the sandbox VM
- How to push baseline vs. DHI image tags and compare size, package count, vulnerabilities, and attestations (SBOM + provenance) in Docker Hub / Docker Scout
Read HANDOFF.md before resuming after a restart. It records the current implementation state, how to relaunch the Labspace, what has already been verified, and the remaining real DHI credential check.
Note
This Labspace uses a host-backed terminal so sbx can create Docker Sandboxes on your machine. Before launching, make sure you have Docker Desktop running, the sbx CLI installed and authenticated (sbx login), and a Docker Personal Access Token that can pull Docker Hardened Images. Step 0 of the lab walks through these prerequisites.
Install or update the Docker Labspace CLI plugin:
gh release download v0.6.0 \
--repo docker/docker-labspace-cli \
--pattern docker-labspace-darwin-arm64 \
--pattern checksums.sha256
shasum -a 256 -c checksums.sha256 --ignore-missing
mkdir -p ~/.docker/cli-plugins ~/.local/bin
install -m 0755 docker-labspace-darwin-arm64 ~/.docker/cli-plugins/docker-labspace
ln -sf ~/.docker/cli-plugins/docker-labspace ~/.local/bin/labspace
docker labspace versionRun the Labspace from this repository root:
CONTENT_PATH=$PWD docker labspace authorFor a one-off local launch without authoring watch mode:
CONTENT_PATH=$PWD docker labspace launch ./compose.yaml -yOpen your browser:
Lab page: http://localhost:3030
Terminal: http://localhost:8085
Inside the Labspace terminal, follow Step 0.
Tip
If the content pull returns 401 Unauthorized, run docker login on the host and launch again.
compose.yamladds the development sync service for host-backed project files.compose.override.yamlswitches the workspace to the Labspacettydprovider and disableshost-republisher.labspace/labspace.yamldefines the lab metadata and sections.project/contains the SBX kits demo.
If you find something wrong or something that needs to be updated, feel free to submit a PR. If you want to make a larger change, feel free to fork the repo into your own repository.
Important note: If you fork it, you will need to update the GHA workflow to point to your own Hub repo.
- Clone this repo
- Start the Labspace in content development mode:
# On Mac/Linux
CONTENT_PATH=$PWD docker compose up --watch
# On Windows with PowerShell
$Env:CONTENT_PATH = (Get-Location).Path; docker compose up --watch
- Open the Labspace at http://localhost:3030.
- Make the necessary changes and validate they appear as you expect in the Labspace Be sure to check out the docs for additional information and guidelines.