Exploring the Latest in Docker Sandboxes Features
A kit is how you package an agent, or something you bolt onto one, for Docker Sandboxes. A v3 kit is a single OCI image. Its layers are the content. A descriptor in the manifest annotation lists typed capability requests that the host either grants or refuses.
v0.48.0 adds five things to the v3 runtime:
| Feature | What it gives you |
|---|---|
| Capability groups | All-or-nothing bundles of capabilities, optionally skippable as a unit |
${{ kit.env.NAME }} | Capability config resolved against the final container environment |
agent-skill@1 | Ship Agent Skills inside your kit image |
ssh-agent@1 | Let the agent use your SSH keys, bounded to what it may sign |
git-identity@1 | Commit as you, without copying your .gitconfig into the sandbox |
We’ll build one mixin, hello-kit, that uses all five. Then we’ll compose it with a workload and check each feature from inside the sandbox.
Step 0: Layout
mkdir -p ~/kits-demo/hello-kit/skill/hello-kit && cd ~/kits-demo
hello-kit/
├── hello-kit.yaml # the v3 descriptor
├── hello-kit.dockerfile # content recipe (found by filename stem)
└── skill/hello-kit/SKILL.md
Step 1: Write the descriptor
hello-kit/hello-kit.yaml:
# syntax=docker/sandbox-kit:3
schemaVersion: "3"
kind: mixin
displayName: Hello 0.48
description: Demo mixin exercising the Docker Sandboxes v0.48.0 kit features
version: "1.0.0"
provides: ["hello-kit@1.0.0"]
capabilities:
# Runs at create and on every subsequent sandbox start.
- type: com.docker.sandbox/lifecycle@1
config:
files:
# kit.env: resolved against the final container environment at create.
- path: "${{ kit.env.HOME }}/.config/hello-kit/agent.conf"
mode: "0644"
content: |
greeting=hello from v0.48.0
startup:
- command: |
set -eu
echo "$(date -u +%FT%TZ) startup hook ran for agent=${SBX_AGENT:-unset}" \
>> "$HOME/hello-kit.log"
env: [SBX_AGENT]
description: Record each sandbox start
# Optional group: either every member is granted, or the group is skipped.
- group:
name: Git attribution and signing
description: Commit as the user and sign with their SSH key
optional: true
capabilities:
- type: com.docker.sandbox/git-identity@1
description: Attribute commits to the user's Git identity
- type: com.docker.sandbox/ssh-agent@1
description: Sign git commits with the user's SSH key
config:
phase: runtime
unrestricted: false
sign: [git]
- group:
name: Bundled skill
description: Ship a hello skill to the agent's skill directory
optional: true
capabilities:
- type: com.docker.sandbox/agent-skill@1
config:
path: /usr/share/hello-kit/skill/hello-kit
A few design notes:
- Groups are listed with
- group:among the other capabilities. Withoptional: true, the group’s members are granted together or skipped together, and network rules, lifecycle files and context travel with the group. In 0.48.0, unsupported optional groups are skipped rather than failing creation. kit.envis expanded at create, against the container’s real environment (image defaults → create args → runtime overrides). It isn’t the host’s environment and it doesn’t go through a shell.$HOMEand~would stay literal;${{ kit.env.HOME }}resolves to/home/agent.ssh-agent@1withunrestricted: false, sign: [git]lets the agent make git-namespace signatures and nothing else. It can’t log in to servers or sign arbitrary data.- Lifecycle hook environments are deny-by-default, so
SBX_AGENThas to be listed inenv:.
Step 2: Content recipe and skill
hello-kit/hello-kit.dockerfile:
# syntax=docker/dockerfile:1
FROM scratch
COPY skill /usr/share/hello-kit/skill
Keep skill sources outside the agent’s discovery directory. The runtime assembles that directory itself and would hide anything you put there.
hello-kit/skill/hello-kit/SKILL.md:
---
name: hello-kit
description: Greets the user and prints the Docker Sandboxes agent name. Use when asked to say hello from the sandbox.
---
Run `echo "Hello from $SBX_AGENT running in a Docker Sandbox"` and report the output.
Step 3: Validate in one second
The BuildKit frontend checks the descriptor before building any content:
cd hello-kit && docker buildx build . -f hello-kit.yaml --output type=cacheonly
#12 [1/1] COPY skill /usr/share/hello-kit/skill
#13 [kit] stage sources /usr/share/sandbox/kit/hello-kit
#13 DONE 0.0s
sbx kit inspect ./
KITS
✓ ./ — built (1s)
sbx-kit-src:hello-kit-c13efd8d8bfc
Name: .
Kind: mixin
Schema: v3
Display: Hello 0.48
Template: sbx-kit-src:hello-kit-c13efd8d8bfc
sbx kit validateis for v2spec.yamlkits. For a v3 source kit, usesbx kit inspector thebuildxcheck above.
Step 4: Three errors I hit, and what they teach
These are worth knowing before you start.
4a. Groups and kit.env need a v3 workload. I first tried to compose onto the built-in claude agent:
sbx create claude ./ws3 --kit ./hello-kit
error: resolve kits: kit ./hello-kit declares capability groups or environment references,
which resolve only when it is composed with its workload; pass the workload and the kit together
Groups and kit.env are resolved when the kit is composed with its workload. The built-in agents aren’t v3 workloads yet, so you have to pass a v3 workload kit as the first argument. The same error comes back from sbx kit add, for the same reason.
4b. Bundled skills need a destination. Composing onto the spec repo’s plain shell workload:
error: request failed: 400 Bad Request: kit set bundles the skills hello-kit but declares
no com.docker.sandbox/agent-skills@1 destination to expose them in
agent-skill@1 supplies the skill. The workload has to say where skills go with agent-skills@1 (for Claude, that’s /home/agent/.claude/skills). An optional group doesn’t avoid this check.
4c. Built-in names are reserved.
error: agent "claude" is already registered (built-in agents cannot be overridden by a kit)
The kit name comes from the descriptor’s filename stem, so I renamed claude.yaml to claude-agent.yaml.
Step 5: Get a v3 Claude workload
The sandbox-kit-spec repo ships a reference v3 claude workload that declares agent-skills@1:
cd ~/kits-demo
git clone -q --depth 1 --filter=blob:none --sparse https://github.com/docker/sandbox-kit-spec spec
git -C spec sparse-checkout set examples/claude
cp -R spec/examples/claude claude-agent && cd claude-agent
mv claude.yaml claude-agent.yaml
mv claude.dockerfile claude-agent.dockerfile
mv claude-context.md claude-agent-context.md
sed -i '' 's#\./claude-context.md#./claude-agent-context.md#' claude-agent.yaml # GNU sed: drop the ''
cd ..
Step 6: Compose the workload and the mixin
mkdir -p ws3
sbx create ./claude-agent ./ws3 --kit ./hello-kit --name kits-sandbox
KITS
✓ ./claude-agent — built (1m19s)
✓ ./hello-kit — cached
AGENT
assembling kit image from 2 kits
✓ assembled kit image (12 layers)
setting 2 environment variables
running 4 install commands
writing 1 init file
registering 4 startup commands, run on every container start
○ sh -c set -eu echo "$(date -u +%FT%TZ) startup hook ran for… (kit=hello-kit, user=1000)
view startup log: cat /var/log/sbx-kit-startup.log
✓ Created sandbox kits-sandbox
Step 7: Verify each feature from inside the sandbox
sbx exec kits-sandbox -- bash -c '
echo SBX_AGENT=$SBX_AGENT
echo "--- startup log"; cat ~/hello-kit.log
echo "--- kit.env file"; ls -l ~/.config/hello-kit/agent.conf; cat ~/.config/hello-kit/agent.conf
echo "--- git identity"; git config --global --get user.name; git config --global --get user.email
echo "--- ssh agent"; ssh-add -L | cut -c1-50
echo "--- skill"; ls -la ~/.claude/skills/ | grep hello
echo "--- descriptors"; ls /usr/share/sandbox/kit/'
SBX_AGENT=claude-agent
--- startup log
2026-10-17T04:36:33Z startup hook ran for agent=claude-agent
--- kit.env file
-rw-r--r-- 1 agent agent 28 Oct 17 04:36 /home/agent/.config/hello-kit/agent.conf
greeting=hello from v0.48.0
--- git identity
Your Name
you@example.com
--- ssh agent
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDtWmWb173068R
--- skill
lrwxrwxrwx 1 agent agent 36 Oct 17 04:36 hello-kit -> /usr/share/hello-kit/skill/hello-kit
--- descriptors
claude-agent
hello-kit
(I’ve replaced my own name and email in the output. The runtime supplies whatever identity you’ve configured on the host.)
What this shows:
- ✅
kit.env:${{ kit.env.HOME }}became/home/agent, and the file is owned byagent. - ✅
git-identity@1:user.name/user.emailare set as global defaults. Only those two values come across; no credential helpers, aliases or includes. - ✅
ssh-agent@1: the public key is visible. The private key stays on the host. - ✅
agent-skill@1: the skill is linked into~/.claude/skills, alongside skills shared from the host. - ✅ Self-describing kits: each kit’s descriptor is under
/usr/share/sandbox/kit/<kit>/.
Step 8: Prove the SSH grant is bounded
Sign a commit with the forwarded key:
sbx exec kits-sandbox -- bash -c '
cd /tmp && git init -q r && cd r
git config gpg.format ssh
git config user.signingkey "key::$(ssh-add -L | head -1)"
echo hi > a && git add a && git commit -q -S -m "signed from sandbox"
echo "agent namespaces=\"git\" $(ssh-add -L | head -1)" > /tmp/allowed
git -c gpg.ssh.allowedSignersFile=/tmp/allowed verify-commit HEAD'
Good "git" signature for agent with ED25519 key SHA256:CzmXYVWvtnvDtINSHdQ0RoQ5seLSRy90rqzneuThcv8
Now try an SSH login, which this grant doesn’t include:
sbx exec kits-sandbox -- ssh -o BatchMode=yes -T git@github.com
# Connection closed by 20.207.73.82 port 22
sbx policy log kits-sandbox --format json | jq '.blocked[] | select(.host|endswith(":22")) | {host,reason}'
{
"host": "20.207.73.82:22",
"reason": "No matching allow rule (default deny)"
}
Two separate layers stop it. The network policy blocks port 22, and the agent grant only allows the git signing namespace. Allowing a login means changing both: add authenticate: [git@github.com] to ssh-agent@1 and allow github.com:22 in network-policy@1. The spec repo’s github-ssh example does exactly that.
Step 9: Capability cheat sheet
# Git identity: config-less; MUST NOT carry `config:`
- type: com.docker.sandbox/git-identity@1
# SSH agent, bounded
- type: com.docker.sandbox/ssh-agent@1
config:
phase: runtime # install | runtime | [install, runtime]
unrestricted: false
sign: [git] # namespaces (git, file, …)
authenticate: [git@github.com] # [user@]host, literal, lowercase
# Bundled skill
- type: com.docker.sandbox/agent-skill@1
config:
path: /usr/share/<kit>/skills/<skill> # literal; must contain SKILL.md
name: optional-override
# Group
- group:
name: …
optional: true
capabilities: [ … ]
Clean up
sbx rm kits-sandbox --force
Next up, Part 3: adding a kit with startup commands to an existing sandbox using sbx kit add, and using SBX_AGENT in your hooks.
References: v0.48.0 release notes · Kit spec v3 · capability pages