agentleFS
scoobydont-666scoobydont-666/shared-claude-skills/skills/container-sandbox/SKILL.md

container-sandbox

Skill1 starsChanged 5 months agoMITView on GitHub

Run risky or destructive operations inside ephemeral Docker containers for isolation. Use when executing untrusted scripts, destructive Ansible playbooks, or operations that could damage the host.

  • Reads credentials
  • Deletes or force-pushes
  • Installs packages

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run potentially dangerous operations inside ephemeral Docker containers.

    line 15
  2. Distinctive:

    After running operations in the sandbox:

    line 70
  3. Distinctive:

    When Claude needs to run something risky, instruct it to:

    line 90

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Container Sandbox — Isolated Execution Environment

Run potentially dangerous operations inside ephemeral Docker containers. The host filesystem is protected — containers get read-only project mounts with a writable overlay.

When to Use

  • Destructive Ansible playbooks (--force, --limit testing)
  • Untrusted scripts from external sources
  • Operations that modify system state (rm -rf, package installs)
  • Testing migrations or schema changes before applying to production
  • Running code from unknown repos

Quick Start

Basic sandbox (Ubuntu + project files):

docker run --rm -it \
  -v "$(pwd):/project:ro" \
  -v /tmp/sandbox-work:/work \
  -w /work \
  ubuntu:24.04 \
  bash -c "cp -r /project/* /work/ && bash"

Python sandbox (with project deps):

docker run --rm -it \
  -v "$(pwd):/project:ro" \
  -v /tmp/sandbox-work:/work \
  -w /work \
  python:3.12-slim \
  bash -c "cp -r /project/* /work/ && pip install -r requirements.txt 2>/dev/null; bash"

GPU sandbox (for CUDA operations):

docker run --rm -it --gpus all \
  -v "$(pwd):/project:ro" \
  -v /tmp/sandbox-work:/work \
  -w /work \
  nvidia/cuda:13.1-devel-ubuntu24.04 \
  bash

Ansible dry-run sandbox:

docker run --rm -it \
  -v /opt/ai-project:/project:ro \
  -v ~/.ssh:/root/.ssh:ro \
  -w /work \
  --network host \
  willhallonline/ansible:latest \
  bash -c "cp -r /project/* /work/ && ansible-playbook -i inventory playbook.yml --check --diff"

Extracting Results

After running operations in the sandbox:

# Copy results out of the sandbox work directory
docker cp <container_id>:/work/results/ ./sandbox-results/

# Or use the /tmp/sandbox-work mount (persists after --rm if pre-created)
ls /tmp/sandbox-work/

Safety Rules

  1. Always mount project directories as :ro (read-only)
  2. Use /tmp/sandbox-work or /work for writable operations
  3. Use --rm to auto-cleanup containers after exit
  4. Use --network none for maximum isolation (no internet access)
  5. Never mount / or /home as writable into a sandbox
  6. GPU sandboxes (--gpus all) still share the host GPU — use for testing, not isolation

Integration with Claude Code

When Claude needs to run something risky, instruct it to:

  1. Build the Docker command with appropriate mounts
  2. Execute the command via Bash tool
  3. Capture stdout/stderr from the container
  4. Extract any produced files from the work directory
  5. Clean up: rm -rf /tmp/sandbox-work

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

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.