docker-sandbox
Skill1 starsChanged 7 months agoMITView on GitHub
Create and manage Docker sandboxed VM environments for safe agent execution. Use when running untrusted code, exploring packages, or isolating agent workloads. Supports Claude, Codex, Copilot, Gemini, and Kiro agents with network proxy controls.
- Reads credentials
- Installs packages
We split this skill into the rules it gives an agent
6 rules. 0 are common, 2 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Run agents and commands in isolated VM environments using Docker Desktop's sandbox feature.
- Very specific: line 229
Always name your sandboxes (docker sandbox create my-project) — unnamed sandboxes are hard to track and clean up
- Very specific: line 231
Use docker sandbox stop before switching branches — the sandbox filesystem doesn't track git state
- Very specific: line 233
Prefer docker sandbox exec over docker exec — the sandbox wrapper handles path translation and environment setup
- Very specific: line 234
Check docker sandbox ls regularly — orphaned sandboxes consume disk and memory silently
- Distinctive: line 239
Update Docker Desktop to 4.49+.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Docker Sandbox
Run agents and commands in isolated VM environments using Docker Desktop's sandbox feature. Each sandbox gets its own lightweight VM with filesystem isolation, network proxy controls, and workspace mounting via virtiofs.
When to Use
- Exploring untrusted packages or skills before installing them system-wide
- Running arbitrary code from external sources safely
- Testing destructive operations without risking the host
- Isolating agent workloads that need network access controls
- Setting up reproducible environments for experiments
Requirements
- Docker Desktop 4.49+ with the
docker sandboxplugin - Verify:
docker sandbox version
Quick Start
Create a sandbox for the current project
docker sandbox create --name my-sandbox claude .This creates a VM-isolated sandbox with:
- The current directory mounted via virtiofs
- Node.js, git, and standard dev tools pre-installed
- Network proxy with allowlist controls
Run commands inside
docker sandbox exec my-sandbox node --version
docker sandbox exec my-sandbox npm install -g some-package
docker sandbox exec -w /path/to/workspace my-sandbox bash -c "ls -la"Run an agent directly
# Create and run in one step
docker sandbox run claude . -- -p "What files are in this project?"
# Run with agent arguments after --
docker sandbox run my-sandbox -- -p "Analyze this codebase"Commands Reference
Lifecycle
# Create a sandbox (agents: claude, codex, copilot, gemini, kiro, cagent)
docker sandbox create --name <name> <agent> <workspace-path>
# Run an agent in sandbox (creates if needed)
docker sandbox run <agent> <workspace> [-- <agent-args>...]
docker sandbox run <existing-sandbox> [-- <agent-args>...]
# Execute a command
docker sandbox exec [options] <sandbox> <command> [args...]
-e KEY=VAL # Set environment variable
-w /path # Set working directory
-d # Detach (background)
-i # Interactive (keep stdin open)
-t # Allocate pseudo-TTY
# Stop without removing
docker sandbox stop <sandbox>
# Remove (destroys VM)
docker sandbox rm <sandbox>
# List all sandboxes
docker sandbox ls
# Reset all sandboxes
docker sandbox reset
# Save snapshot as reusable template
docker sandbox save <sandbox>Network Controls
The sandbox includes a network proxy for controlling outbound access.
# Allow specific domains
docker sandbox network proxy <sandbox> --allow-host example.com
docker sandbox network proxy <sandbox> --allow-host api.github.com
# Block specific domains
docker sandbox network proxy <sandbox> --block-host malicious.com
# Block IP ranges
docker sandbox network proxy <sandbox> --block-cidr 10.0.0.0/8
# Bypass proxy for specific hosts (direct connection)
docker sandbox network proxy <sandbox> --bypass-host localhost
# Set default policy (allow or deny all by default)
docker sandbox network proxy <sandbox> --policy deny # Block everything, then allowlist
docker sandbox network proxy <sandbox> --policy allow # Allow everything, then blocklist
# View network activity
docker sandbox network log <sandbox>Custom Templates
# Use a custom container image as base
docker sandbox create --template my-custom-image:latest claude .
# Save current sandbox state as template for reuse
docker sandbox save my-sandboxWorkspace Mounting
The workspace path on the host is mounted into the sandbox via virtiofs. The mount path inside the sandbox preserves the host path structure:
| Host OS | Host Path | Sandbox Path |
| Windows | H:\Projects\my-app | /h/Projects/my-app |
| macOS | /Users/me/projects/my-app | /Users/me/projects/my-app |
| Linux | /home/me/projects/my-app | /home/me/projects/my-app |
The agent's home directory is /home/agent/ with a symlinked workspace/ directory.
Environment Inside the Sandbox
Each sandbox VM includes:
- Node.js (v20.x LTS)
- Git (latest)
- Python (system)
- curl, wget, standard Linux utilities
- npm (global install directory at
/usr/local/share/npm-global/) - Docker socket (at
/run/docker.sock- Docker-in-Docker capable)
Proxy Configuration (auto-set)
HTTP_PROXY=http://host.docker.internal:3128
HTTPS_PROXY=http://host.docker.internal:3128
NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/proxy-ca.crt
SSL_CERT_FILE=/usr/local/share/ca-certificates/proxy-ca.crtImportant: Node.js fetch (undici) does NOT respect HTTP_PROXY env vars by default. For npm packages that use fetch, create a require hook:
// /tmp/proxy-fix.js
const proxy = process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
if (proxy) {
const { ProxyAgent } = require('undici');
const agent = new ProxyAgent(proxy);
const origFetch = globalThis.fetch;
globalThis.fetch = function(url, opts = {}) {
return origFetch(url, { ...opts, dispatcher: agent });
};
}Run with: node -r /tmp/proxy-fix.js your-script.js
Patterns
Safe Package Exploration
# Create isolated sandbox
docker sandbox create --name pkg-test claude .
# Restrict network to only npm registry
docker sandbox network proxy pkg-test --policy deny
docker sandbox network proxy pkg-test --allow-host registry.npmjs.org
docker sandbox network proxy pkg-test --allow-host api.npmjs.org
# Install and inspect the package
docker sandbox exec pkg-test npm install -g suspicious-package
docker sandbox exec pkg-test bash -c "find /usr/local/share/npm-global/lib/node_modules/suspicious-package -name '*.js' | head -20"
# Check for post-install scripts, network calls, file access
docker sandbox network log pkg-test
# Clean up
docker sandbox rm pkg-testPersistent Dev Environment
# Create once
docker sandbox create --name dev claude ~/projects/my-app
# Use across sessions
docker sandbox exec dev npm test
docker sandbox exec dev npm run build
# Save as template for team sharing
docker sandbox save devLocked-Down Agent Execution
# Deny-all network, allow only what's needed
docker sandbox create --name secure claude .
docker sandbox network proxy secure --policy deny
docker sandbox network proxy secure --allow-host api.openai.com
docker sandbox network proxy secure --allow-host github.com
# Run agent with restrictions
docker sandbox run secure -- -p "Review this code for security issues"Tips
- Always name your sandboxes (
docker sandbox create my-project) — unnamed sandboxes are hard to track and clean up - Mount only the directory you need, not your entire home folder — the agent can read anything you mount
- Use
docker sandbox stopbefore switching branches — the sandbox filesystem doesn't track git state - The network proxy only intercepts HTTP/HTTPS — raw TCP connections (databases, SSH) bypass it entirely
- Prefer
docker sandbox execoverdocker exec— the sandbox wrapper handles path translation and environment setup - Check
docker sandbox lsregularly — orphaned sandboxes consume disk and memory silently
Troubleshooting
"client version X is too old"
Update Docker Desktop to 4.49+. The sandbox plugin requires engine API v1.44+.
"fetch failed" inside sandbox
Node.js fetch doesn't use the proxy. Use the proxy-fix.js require hook above, or use curl instead:
docker sandbox exec my-sandbox curl -sL https://api.example.com/dataPath conversion on Windows (Git Bash / MSYS2)
Git Bash converts /path to C:/Program Files/Git/path. Prefix commands with:
MSYS_NO_PATHCONV=1 docker sandbox exec my-sandbox ls /home/agentSandbox won't start after Docker update
docker sandbox reset # Clears all sandbox stateOther versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- weininghui/skills★ 199% same
Wrote their own version · 5
- infection/infection★ 2.3ksame name
- joelhooks/joelclaw★ 64same name
- jnotsknab/mux-swarm★ 9same name
- alphacrack/readme2demo★ 8same name
- ariana-dot-dev/cloud-sandbox-vm-skills★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository25 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- api-devSkill
- cicd-pipelineSkill
- coding-agentSkill
- container-debugSkill
- cron-schedulingSkill
- csv-pipelineSkill
- data-validationSkill
- dns-networkingSkill
- emergency-rescueSkill
- encoding-formatsSkill
- git-workflowsSkill
- infra-as-codeSkill
- log-analyzerSkill
- makefile-buildSkill
- perf-profilerSkill
- regex-patternsSkill
- security-auditSkill
- shell-scriptingSkill
- skill-reviewerSkill
- skill-search-optimizerSkill
- skill-writerSkill
- sql-toolkitSkill
- ssh-tunnelSkill
- test-patternsSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

