Installation
copilot plugin marketplace add samueltauil/skills-hub
copilot plugin install docker-agent-run@skills-hub
Works with GitHub Copilot CLI and VS Code (enable chat.plugins.enabled).
Plugin docker-agent-run v1.0.0 follows the Agent Plugins spec.
gh skills-hub install docker-agent-run Don't have the extension? Run gh extension install samueltauil/skills-hub first.
Download and extract to your repository:
.github/skills/docker-agent-run/ Extract the ZIP to .github/skills/ in your repo. The folder name must match docker-agent-run for Copilot to auto-discover it.
Skill Files (7)
SKILL.md 8.4 KB
---
name: docker-agent-run
description: Use this skill when running a Docker Agent with `docker agent run`, choosing a safety/approval mode, using the `--sandbox` isolation flag, setting up aliases, or troubleshooting a run (missing credentials, worktrees). Even if the user just says they want to "run my agent", "make my agent auto-approve tool calls", "run this agent safely", or "why can't my agent see my API key", this skill applies. Covers `--safety` (strict/balanced/restricted/autonomous), `--yolo`, `--sandbox` and its network allowlist, `--worktree`, `docker agent alias`, and `docker agent doctor`.
license: Apache-2.0
compatibility: Requires the docker-agent CLI plugin (Docker Desktop 4.63+, or standalone via Homebrew/GitHub releases). Sandbox mode (`--sandbox`) additionally requires the `sbx` CLI. Verified against docker-agent as shipped with Docker CLI 29.7.2.
---
# Docker Agent: Running and Operating Agents
## Overview
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.
## When to use this skill
Activate this skill when:
- The user wants to run an agent interactively or headlessly (`--exec`).
- The user is choosing or debugging `--safety`, `--yolo`, or approval behavior for tool calls.
- The user wants to isolate an agent's shell/filesystem access with `--sandbox`, or hit a sandbox network-policy error.
- The user wants a reusable shortcut (`docker agent alias`), a scoped git worktree (`--worktree`), or is debugging credentials/model availability (`docker agent doctor`).
## Do not use this skill when
Do not use this skill when:
- The task uses standalone `sbx run/create/stop/rm` rather than
`docker agent run --sandbox` — use `docker-sandboxes-lifecycle`.
- The task is standalone `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".
- The task is writing or editing the `agent.yaml` itself (models, toolsets, sub_agents) — use `docker-agent-config`.
- The task is exposing an agent as a server (`serve`), sharing it via a registry (`share`), or evaluating it (evaluation sessions, `--baseline` regression gates) — use `docker-agent-deploy`.
## Core guidance
### Safety modes
- `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`.
- Never default an unattended run (cron, CI, a server endpoint) to
`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.
```bash
# CI-safe: unreviewed tool calls are denied, not silently approved.
docker agent run --exec --safety restricted ./agent.yaml "Triage the failing test"
```
- Bake a safety default into an alias so callers don't have to remember it,
and note that an explicit CLI `--safety`/`--yolo` on `docker agent run`
still overrides the alias:
```bash
docker agent alias add safe-coder myorg/coder --safety balanced
```
### Sandbox isolation
- `--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.
```bash
docker agent run --sandbox ./agent.yaml
```
- The sandbox network proxy is **default-deny**: only the model provider,
`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:
```bash
docker agent sandbox allow api.example.com
docker agent sandbox list
docker agent sandbox deny api.example.com
```
- Prefer baking `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.
- Sandboxes persist and are reused across runs from the same workspace —
they are not torn down when the session ends. Don't expect a clean VM on
every run; if you need one, change the mount set (e.g. a new kit) to force
recreation.
### Aliases and default agent
- Register a shortcut once, then run it by name instead of a path:
```bash
docker agent alias add code myorg/notion-expert
docker agent run code
```
- For a local run with no agent argument, `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.
- Set the fallback for directories without a project config with a
`default` alias. To select it even when a project config exists, pass
`default` explicitly:
```bash
docker agent alias add default ./my-agent.yaml
docker agent run default
```
- CLI flags on `docker agent run <alias>` always override the alias's own
stored options (e.g. `docker agent run yolo-coder --yolo=false`).
### Worktrees
- Use `--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:
```bash
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.
### Troubleshooting
- "No model is currently available" or "model ... is not pulled" means the
agent's provider has no usable credential, or (for `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.
- An agent that only *describes* a plan instead of executing it is usually
missing the tool it needs (add `type: shell` or `type: todo` in
`agent.yaml`), not a model failure — hand this back to `docker-agent-config`.
- A `403 Blocked by network policy` error inside a sandbox run means the
destination isn't allowlisted; use `docker agent sandbox allow <host>`.
## Related skills
- For standalone `sbx` lifecycle commands, use `docker-sandboxes-lifecycle`.
- For standalone `sbx policy` and `sbx secret`, use `docker-sandboxes-network-credentials`.
- For writing or changing the underlying `agent.yaml` (models, toolsets, sub_agents), use `docker-agent-config`.
- For serving, sharing, or evaluating the agent, use `docker-agent-deploy`.
## References
- `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.
## Assets
- None.
## Checks
- `checks/verification.md` — Verification runbook for a `docker agent run` invocation.
skill.yaml 1.1 KB
schema: v1
id: docker-agent-run
version: 0.1.2
title: 'Docker Agent: Running and Operating Agents'
description: 'Rules for running Docker Agent locally — safety/approval modes, sandbox isolation, aliases, worktrees, and troubleshooting a run.'
owns:
- docker-agent-run-flags
- docker-agent-safety-modes
- docker-agent-sandbox
- docker-agent-alias
- docker-agent-worktree
use_when:
- The task is invoking docker agent run interactively or headlessly against an existing agent config.
- The task is choosing or debugging --safety, --yolo, or --sandbox behavior for a run.
- The task is creating an alias, a git worktree run, or diagnosing a failed run with docker agent doctor.
do_not_use_when:
- The task uses standalone sbx lifecycle, policy, or secret commands rather than the Docker Agent wrapper.
- The main task is authoring or editing the agent.yaml itself (models, toolsets, sub_agents).
- The main task is serving an agent as a server, sharing it via a registry, or evaluating it.
delegates_to:
- docker-sandboxes-lifecycle
- docker-sandboxes-network-credentials
- docker-agent-config
- docker-agent-deploy
openai.yaml 0.4 KB
interface:
display_name: 'Docker Agent: Running and Operating Agents'
short_description: 'Rules for running Docker Agent locally — safety/approval modes, sandbox isolation, aliases, worktrees, and troubleshooting a run.'
default_prompt: Use this skill when running a Docker Agent with docker agent run, choosing a safety mode, or using the sandbox flag.
policy:
allow_implicit_invocation: true
verification.md 1.6 KB
# Verification Runbook for `docker agent run`
## 1. Credentials and model are resolvable before running
```bash
docker agent doctor ./agent.yaml
```
Pass: the resolved model/provider is reported reachable with credentials
found. Fail: "No model is currently available" — follow the Troubleshooting
section in this skill's `SKILL.md`, then rerun this check.
## 2. The chosen safety mode matches the run context
```bash
docker agent run --exec --safety restricted ./agent.yaml "Delete all files in /tmp/scratch"
```
Use a task that deliberately triggers a non-safe tool call (a destructive
shell command against a throwaway agent/directory is a good probe). Pass
(unattended/CI run): the command exits promptly without hanging on an
approval prompt, and the output reports the destructive call was **denied**
rather than silently executed. Fail: the run hangs waiting for approval —
the mode is too strict for a headless run — or the destructive command
actually executes — the mode is too permissive; move to `balanced`/`strict`.
## 3. A sandboxed run has the network access it needs
```bash
docker agent run --sandbox ./agent.yaml
```
Pass: the run's printed launch summary shows the allowlisted hosts and no
`403 Blocked by network policy` errors occur for hosts the agent actually
needs. Fail: a `403` for a specific host — run
`docker agent sandbox allow <host>` and rerun.
## 4. An alias resolves to the config and options you expect
```bash
docker agent alias list --json
```
Pass: the alias's `path`, `model`, `safety`, and `sandbox`/`yolo` fields
match what you configured. Fail: missing or wrong fields — recreate the
alias with `docker agent alias add <name> <path> [flags]`.
docker-agent-run.md 4.3 KB
# Eval: docker-agent-run
Skill under test: `skills/docker-agent-run/`
---
## Prompt 1: Unattended CI run
**Prompt to agent:**
> I want to run my agent from a GitHub Actions job with no human to approve tool calls. What flags should I use?
> (AUTOMATED EVAL: You MUST NOT ask questions or request clarification. Proceed immediately with best-practice defaults. Create all necessary files even if the workspace appears empty.)
### Expected behaviors
- [ ] Recommends `--exec` (headless, no TUI) for CI/unattended runs.
- [ ] Recommends a safe execution mode: either `--safety restricted`, `--sandbox`, or explains the tradeoffs between them.
- [ ] Explains that some mode prevents arbitrary tool calls without approval.
### Must not
- [ ] Must NOT recommend `--yolo` or `--safety autonomous` without any warning or caveat about the risks.
### Verification commands
```bash
docker agent run --exec --safety restricted ./agent.yaml "<task>"
```
---
## Prompt 2: Sandboxed run hits a network policy error
**Prompt to agent:**
> My Docker Agent fails with "403 Blocked by network policy" for api.example.com when I run it with `docker agent run --sandbox`. How do I fix this?
> (AUTOMATED EVAL: You MUST NOT ask questions or request clarification. Proceed immediately with best-practice defaults. Create all necessary files even if the workspace appears empty.)
### Expected behaviors
- [ ] Identifies the sandbox's network proxy/policy blocking the request as the cause.
- [ ] Recommends adding the domain to the allowlist using `docker agent sandbox allow` or `sbx policy allow network`.
- [ ] Provides a way to inspect/manage the policy (e.g., list rules, check policy, or view logs).
### Must not
- [ ] Must NOT recommend disabling the sandbox entirely as the fix (that changes the security posture, not just the network policy).
### Verification commands
```bash
docker agent sandbox allow api.example.com
docker agent sandbox list
```
---
## Prompt 3: Reusable shortcut for a registry agent
**Prompt to agent:**
> I keep typing `docker agent run myorg/coder --yolo --model anthropic/claude-sonnet-4-5`. Can I make this shorter?
> (AUTOMATED EVAL: You MUST NOT ask questions or request clarification. Proceed immediately with best-practice defaults. Create all necessary files even if the workspace appears empty.)
### Expected behaviors
- [ ] Recommends `docker agent alias add <name> myorg/coder --yolo --model anthropic/claude-sonnet-4-5` or similar alias command.
### Must not
- [ ] Must NOT suggest editing `agent.yaml` as the primary solution to a CLI-ergonomics request (aliases are the better fit).
### Verification commands
```bash
docker agent alias add turbo myorg/coder --yolo --model anthropic/claude-sonnet-4-5
docker agent alias list --json
```
---
## Prompt 4: Project config versus default alias
**Prompt to agent:**
> I have both agent.yaml and docker-agent.yaml in this folder, and a default alias. Which one does a bare docker agent run use, and how do I select the others?
> (AUTOMATED EVAL: You MUST NOT ask questions or request clarification. Proceed immediately with best-practice defaults. Create all necessary files even if the workspace appears empty.)
### Expected behaviors
- [ ] Explains that `docker-agent.yaml` (or `.yml`/`.hcl`) is auto-discovered for bare `docker agent run`.
- [ ] Shows how to explicitly select a file like `agent.yaml` with path syntax (e.g., `docker agent run ./agent.yaml`).
- [ ] Shows how to invoke the default alias with `docker agent run default`.
### Must not
- [ ] Must NOT claim that the default alias is automatically used when a project config file exists (project files take precedence over aliases in auto-discovery).
### Verification commands
```bash
docker agent run --help
docker agent alias list --json
```
Compare the answer with the pinned discovery implementation and tests in
`skills/docker-agent-run/references/sources.md`; help alone does not specify
filename precedence. This is a manual reasoning check, not a live agent run.
---
## Should not trigger
- "Create a standalone sbx sandbox with a private Git clone." → `docker-sandboxes-lifecycle`
- "Set a per-sandbox rule with sbx policy deny network." → `docker-sandboxes-network-credentials`
- "Add a filesystem tool to my agent" → `docker-agent-config`
- "Serve my agent as an MCP server" → `docker-agent-deploy`
- "Set up evaluations for my agent" → `docker-agent-deploy`
safety-and-sandbox.md 2.1 KB
# Safety modes and sandbox reference
## Safety mode / flag interaction
| Mode | Approval behavior | Typical use |
| --- | --- | --- |
| `strict` | Ask before every tool call | First run of an untrusted agent |
| `balanced` | Auto-approve calls classified as safe, ask for the rest | Everyday interactive use |
| `restricted` | Auto-approve safe calls, **deny** the rest | Unattended/CI runs, server modes (`serve` default) |
| `autonomous` (`--yolo`) | Approve everything | Fully trusted or already-sandboxed agent |
Precedence: an explicit `--safety`/`--yolo` on the `docker agent run` command
line always overrides an alias's stored safety option, which in turn
overrides any default baked into `agent.yaml`.
Source: https://docs.docker.com/ai/docker-agent/features/cli/ (Commands >
`docker agent serve chat` shows `restricted` as the serve default;
`docker agent run --help` for the four mode names).
## Sandbox trust boundary
- Boundary: a hypervisor-isolated microVM per sandbox. No shared memory or
processes with the host.
- Crosses into the VM: the mounted workspace directory (read-write by
default), host-injected credential headers (raw values never enter the
VM), and allowlisted outbound TCP.
- Not isolated by default: workspace file changes are live on the host in
direct mode (the default); Git hooks under `.git/` run with host
permissions when a modified script executes; the default network allowlist
includes broad wildcards (e.g. `*.googleapis.com`).
- Local stdio MCP servers run **outside** the sandbox VM, on the host —
treat them as trusted host integrations, not sandboxed ones.
Source: https://docs.docker.com/ai/sandboxes/security/.
## Sandbox network allowlist commands
```bash
docker agent sandbox allow <host>[:<port>] # persist an allowlist entry
docker agent sandbox list # show persisted entries
docker agent sandbox deny <host> # remove one
```
Persisted entries live in `~/.config/cagent/config.yaml` and are unioned with
the inferred and agent-declared allowlists on every `--sandbox` run.
Source: https://docs.docker.com/ai/docker-agent/configuration/sandbox/.
sources.md 1.5 KB
# Sources
- `docker agent run --help`, `docker agent alias --help`, `docker agent alias add --help`, `docker agent sandbox --help`, `docker agent sandbox allow --help`, `docker agent doctor --help` — verified locally against docker-agent as shipped with Docker CLI 29.7.2.
- https://docs.docker.com/ai/docker-agent/features/cli/ — full CLI command/flag reference (`run`, `alias`, `serve`, agent references, runtime configuration flags).
- https://docs.docker.com/ai/docker-agent/configuration/sandbox/ — sandbox mode overview, `--sandbox`/`--template`/`--no-kit` flags, auto-kit, network allowlist, `docker agent sandbox allow/deny/list`.
- https://docs.docker.com/ai/sandboxes/security/ — sandbox security model, trust boundaries, what is/isn't isolated by default, `sbx` prerequisite.
- https://docs.docker.com/ai/docker-agent/community/troubleshooting/ — "No model is currently available" pitfall and `docker agent doctor` usage.
- https://github.com/docker/docker-agent/blob/40fc6eef359d8e68e9c52f39c27b014bb2414bfd/cmd/root/run.go#L596-L619 and https://github.com/docker/docker-agent/blob/40fc6eef359d8e68e9c52f39c27b014bb2414bfd/cmd/root/run_autodiscovery_test.go#L12-L64 — project-config discovery names and ordering, verified against docker-agent dev commit `40fc6eef359d8e68e9c52f39c27b014bb2414bfd` (not the Docker CLI version).
- https://github.com/docker/docker-agent/blob/40fc6eef359d8e68e9c52f39c27b014bb2414bfd/pkg/config/sources/sources.go#L161-L178 — empty references resolve to the `default` alias before the built-in agent, after project discovery in `run`.
License (Apache-2.0)
View full license text
Licensed under the Apache License, Version 2.0. See https://github.com/docker/skills/blob/main/LICENSE