/docker-skills:docker-agent-runfrom docker-skills
Guides running Docker Agents with `docker agent run`, configuring safety/approval modes, sandbox isolation, aliases, worktrees, and troubleshooting runs.
Ships in docker-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
This skill owns the operational side of Docker Agent: invoking docker agent run against a local config, an alias, or a registry reference; choosing how
much autonomy the agent gets over tool calls; isolating it in a sandbox VM;
and diagnosing why a run fails. It assumes the agent.yaml already exists —
see Related skills for authoring it.
Activate this skill when:
--exec).--safety, --yolo, or approval behavior for tool calls.--sandbox, or hit a sandbox network-policy error.docker agent alias), a scoped git worktree (--worktree), or is debugging credentials/model availability (docker agent doctor).Do not use this skill when:
sbx run/create/stop/rm rather than
docker agent run --sandbox — use docker-sandboxes-lifecycle.sbx policy or sbx secret configuration — use
docker-sandboxes-network-credentials. Establish which CLI is in use
before recommending commands when the request only says "my sandbox".agent.yaml itself (models, toolsets, sub_agents) — use docker-agent-config.serve), sharing it via a registry (share), or evaluating it (evaluation sessions, --baseline regression gates) — use docker-agent-deploy.docker agent run supports four --safety modes; choose the least
permissive one that still lets the task finish:
strict — ask for approval before every tool call.balanced — auto-approve calls classified as safe, ask for the rest.restricted — auto-approve safe calls, deny the rest outright. Use
for unattended/CI runs where no human can answer a prompt.autonomous — approve everything automatically. Equivalent to --yolo.autonomous/--yolo. Use restricted for unattended runs so an
unexpected tool call fails closed instead of running unreviewed; reserve
autonomous/--yolo for a sandboxed or fully trusted interactive session.
# CI-safe: unreviewed tool calls are denied, not silently approved.
docker agent run --exec --safety restricted ./agent.yaml "Triage the failing test"
--safety/--yolo on docker agent run
still overrides the alias:
docker agent alias add safe-coder myorg/coder --safety balanced
--sandbox runs the agent inside an isolated microVM managed by the sbx
CLI (a separate prerequisite — install and configure it first). All shell,
filesystem, and process activity started by built-in toolsets happens
inside the VM; only the working directory (and, unless --no-kit, a
staged "kit" of skills/prompt files) is mounted in. Exception: a local
stdio MCP server declared on the agent runs as a host process outside
the sandbox VM — treat any such MCP server as a trusted host integration,
not a sandboxed one.
docker agent run --sandbox ./agent.yaml
models.dev, and hosts the toolset resolver can infer are open. A custom
MCP server or third-party API often needs an explicit allowlist entry —
add it permanently rather than re-discovering it every run:
docker agent sandbox allow api.example.com
docker agent sandbox list
docker agent sandbox deny api.example.com
runtime: {sandbox: true} into the agent's own agent.yaml
over remembering --sandbox on every invocation of that agent; an
explicit --sandbox=false on the CLI still overrides the config default
for a single debug run.docker agent alias add code myorg/notion-expert
docker agent run code
docker agent run discovers
docker-agent.yaml, then docker-agent.yml, then docker-agent.hcl in
the current directory (first match wins). Only if none exists does it
resolve the default alias, falling back to the built-in default agent.
The agent.yaml examples in these skills pass a filename explicitly;
agent.yaml is not an auto-discovery name.default alias. To select it even when a project config exists, pass
default explicitly:
docker agent alias add default ./my-agent.yaml
docker agent run default
docker agent run <alias> always override the alias's own
stored options (e.g. docker agent run yolo-coder --yolo=false).--worktree (-w) to isolate an agent's file edits from your current
checkout — it runs the agent inside a fresh git worktree. For an
interactive session, a clean worktree (no uncommitted changes,
untracked files, or new commits) is removed automatically when the
session ends; one with work prompts you to keep or remove. A headless
run (--exec) never auto-cleans its worktree, regardless of state — it is
left in place for inspection:
docker agent run ./agent.yaml --worktree=auth-refactor --worktree-base origin/main
--worktree cannot be combined with --remote or --sandbox. To resume a
worktree run, pass --session -1 (or the session id) — do not re-pass
--worktree, which fails because the worktree already exists.dmr/) the model
hasn't been pulled. Run docker agent doctor ./agent.yaml first — it
reports the resolved model/provider and whether credentials were found —
before touching the YAML. If credentials are missing, export the provider's
API key; if a DMR model is missing, run docker model pull <model>. Rerun
doctor before retrying the task.type: shell or type: todo in
agent.yaml), not a model failure — hand this back to docker-agent-config.403 Blocked by network policy error inside a sandbox run means the
destination isn't allowlisted; use docker agent sandbox allow <host>.sbx lifecycle commands, use docker-sandboxes-lifecycle.sbx policy and sbx secret, use docker-sandboxes-network-credentials.agent.yaml (models, toolsets, sub_agents), use docker-agent-config.docker-agent-deploy.references/safety-and-sandbox.md — full safety-mode/flag interaction table and sandbox trust-boundary details.references/sources.md — provenance of every rule in this skill.checks/verification.md — Verification runbook for a docker agent run invocation.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub docker/skills --plugin docker-skills11 skills in this plugin
/docker-agent-configUse this skill when creating or editing an agent.yaml (or .yml/.hcl) configuration file for Docker Agent (cagent), including defining agents, models/providers, built-in or MCP toolsets, multi-agent teams with sub_agents. Even if the user just says they want to "build an AI agent with Docker", "make a coding agent config", "add a tool to my agent", or "set up a team of agents", this skill applies. Covers agent properties (model, instruction, toolsets, sub_agents, fallback), the models/providers sections, built-in toolsets (filesystem, shell, think, todo, memory, fetch), MCP toolset references, and named commands./docker-agent-deployUse this skill when exposing a Docker Agent as a server (MCP, HTTP API, A2A, ACP, or OpenAI-compatible chat), distributing an agent via an OCI registry with `docker agent share`, or measuring agent quality with `docker agent eval`. Even if the user just says they want to "turn my agent into an MCP server", "let Claude Desktop use my agent", "publish my agent to Docker Hub", "push my agent like an image", or "test my agent in CI", this skill applies. Covers `serve mcp/api/a2a/acp/chat` listen addresses and auth flags, `share push/pull`, eval session JSON format, scoring metrics, and the `--baseline` regression gate./docker-build-strategiesUse this skill when writing, reviewing, or optimizing Dockerfiles, even if the user just says their image is too large, their build is slow, or they need to harden a container for production. Covers multi-stage builds, layer caching, .dockerignore, non-root users, and image size optimization./docker-compose-patternsUse this skill when creating, modifying, or debugging Docker Compose configurations, even if the user just says they need to wire services together, add a database to their stack, or set up a local development environment with multiple containers. Covers service definitions, health checks, dependency ordering, volumes, networks, environment variables, and development overrides./docker-destructive-guardrailsUse this skill before running, or recommending, any Docker command that deletes, wipes, resets, or otherwise irreversibly changes state — even if the user just says to "clean up", "clear the cache", "start fresh", "wipe everything", "nuke it", "reset", "force remove", or "tear down" Docker resources. Covers generic Docker CLI destructive operations not owned by a more specific skill — `docker rm`, `docker rm -f`, `docker container prune`, `docker kill`, `docker system prune`, `docker rmi`/`docker image rm`, `docker image prune -a`, `docker network rm`, `docker network prune`, `docker builder prune`, `docker buildx rm`, `docker context rm`, and standalone (non-Compose) `docker volume rm`/`docker volume prune`. Also indexes destructive commands owned by other Docker skills (Compose, sandbox, Desktop). Core rule — state exactly what will be lost and get explicit confirmation first, except narrow, low-friction Tier 1 container cleanup./docker-docsUse this skill to answer questions about any Docker product from current official Docker documentation instead of memory, even if the user just asks "how do I…", "does Docker support…", "what's the flag for…", or "is this still the right way" about Docker. Covers Docker Desktop, Engine, Build/Buildx/Build Cloud, Compose, Hub, Scout, Docker Hardened Images (DHI), Offload, Testcontainers, Docker Sandboxes (`sbx`, local and cloud sandboxes, Sandboxes API/SDK), Docker Agentic Platform, Docker Agent, MCP Catalog/Toolkit/Gateway, Model Runner, Gordon, and account, admin, security, and billing docs. Searches with the `search_docker_docs` MCP tool when available and otherwise falls back to `docs.docker.com/llms.txt` and per-page Markdown.Other plugins' skills for the same job