Run the lab in a Docker Sandbox
You can run this lab with sbx instead of Docker Compose. Everything (instructions, VS Code, and a private Docker engine for the lab, the Kind cluster included) runs in a single microVM, and sbx rm removes everything the lab created.
Note: No AI agent is involved, even though this runs in Docker Sandboxes: the lab uses the plain
shellsandbox, and you type every command yourself.
The kits
This option uses Sandbox Kits, layered onto the shell sandbox:
- the Labspace kit from mathieu-benoit/labsbxes, which runs the interface and the IDE;
- the score-dev-mixin kit of this repository (in sbx-kits/score-dev-mixin/), which carries the lab's tools (
score-compose,score-k8s,kind,kubectlandhelm), the port of the app deployed withscore-compose(8080), the network access they need, and the VS Code YAML extension with the Score JSON schema mapping, set up in the Labspace kit'scode-server. It doesn't depend on the lab: add it to any sandbox to use Score there (see its README); - the content kit of this repository (in sbx-kits/score-labsbx-mixin/), which carries
labspace/(with the lab's browser tab icon,labspace/icon.svg) and the sample app. It requires the Labspace kit and the score-dev-mixin kit:sbxrefuses to start it without them.
They are also published together as one reference: the kit set score-labsbx.yaml merges the three with the shell sandbox into a single workload kit, docker.io/scorespec/score-labsbx (see Kit sets).
Before you start
The kits of this lab are on Docker Hub, but the Labspace kit is on GHCR, and by default sbx only installs kits from docker.io/ and dhi.io/, so first allow the Labspace kit's namespace:
sbx settings set kit.allowedSources '["docker.io/","dhi.io/","ghcr.io/mathieu-benoit/"]'
Run the lab
From an empty folder (sbx run mounts the current folder as the workspace), run the kit set:
sbx run docker.io/scorespec/score-labsbx:latest -p 3030:3030 -p 8085:8085 -p 8080:8080 --name score-lab -d
This is the same as passing the three kits yourself onto shell:
sbx run shell --kit ghcr.io/mathieu-benoit/labsbxes/labspace:latest --kit docker.io/scorespec/score-dev-mixin:latest --kit docker.io/scorespec/score-labsbx-mixin:latest -p 3030:3030 -p 8085:8085 -p 8080:8080 --name score-lab -d
The set pins the exact version of each kit it was built with, including shell, so it changes only when it is republished; passing the three :latest kits onto shell picks up each one's newest version.
Then open the Labspace in your web browser: http://localhost:3030.
-p 3030:3030pins the Labspace's address: without it,sbxpicks a random host port, thatsbx port ls score-lablists for the sandbox port3030.-p 8085:8085is required: the Labspace embeds the IDE athttp://localhost:8085.-p 8080:8080lets you open the workload deployed withscore-compose(http://<dns>.localhost:8080) from your own web browser.- Stop the lab with
sbx stop score-lab, restart it withsbx run --name score-lab -d.
Tear down the lab
When you are done, delete the sandbox:
sbx rm score-lab
This removes everything the lab created: the containers, images, volumes, networks and Kind cluster of the sandbox's private Docker engine, and your changes to the lab's project. When you ran from a clone with ./sbx-kits/score-labsbx-mixin, the sample app and your edits to it are in the clone's project/ folder and stay there.
How it works
A few things differ from the Compose setup, and the kits take care of them:
- The sandbox VM has no
/dev/kmsg, without which the kubelet of the Kind node doesn't start: a startup hook of the score-dev-mixin kit creates it. - The sandbox's network proxy intercepts the TLS connections to Docker Hub with its own CA, which the Kind nodes don't trust: the score-dev-mixin kit's
kindwrapper adds that CA to the nodes afterkind create cluster. - The sandbox only reaches the hosts its network policy allows: the score-dev-mixin kit allows the ones the tools use (Docker Hub,
mirror.gcr.io, GitHub,ghcr.io), and the content kit addsdhi.io, for the sample app's Dockerfile.