← All cheatsheets
Docker Sandboxes (sbx) Cheatsheet
Standalone CLI for ephemeral, isolated sandboxes — built for running AI agents securely.
What it is
Docker sbx creates lightweight, ephemeral container sandboxes that give AI agents a safe, isolated environment to execute code, run commands, and explore data without affecting the host.
Installation
Install with docker sbx install or as part of Docker Desktop. Run docker sbx version to verify.
Quick start
Create a new ephemeral sandbox.
Execute a command inside a sandbox.
Show all active sandboxes.
Destroy a sandbox.
Common commands
| Task | Command | Description |
|---|---|---|
| Create sandbox | docker sbx create | Allocate a new isolated sandbox container. |
| Run command | docker sbx run <id> -- <cmd> | Execute a command inside the sandbox. |
| List sandboxes | docker sbx list | Show all active sandboxes. |
| Inspect sandbox | docker sbx inspect <id> | Show sandbox metadata and status. |
| Remove sandbox | docker sbx rm <id> | Destroy and clean up a sandbox. |
| Copy files in | docker sbx cp <src> <id>:<dest> | Copy files into a sandbox. |
Real-world examples
Create a sandbox and run Python
ID=$(docker sbx create)
docker sbx run $ID -- python3 -c "print(42)"Give an AI agent a sandbox to work in
# Create sandbox
ID=$(docker sbx create)
# Let agent execute code
docker sbx run $ID -- bash -c "pip install pandas && python3 analyze.py"
# Clean up
docker sbx rm $IDBest practices
- Always destroy sandboxes after use — they are ephemeral by design.
- Use sbx to give AI agents code execution abilities without host access.
- Mount only the minimum files needed into a sandbox.
Related cheatsheets
Last reviewed: 2026-06-15