docker-agent-deploy
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDocker Agent: Serving, Sharing, and Evaluating
Docker Agent:服务、分享与评估
Overview
概述
This skill owns the integration surface of Docker Agent: making an agent
reachable by other software (), distributing it through
an OCI registry the way container images are distributed (), and proving it still behaves after a change ().
It assumes the agent config already exists — see for
authoring it, and for interactive/local invocation.
docker agent servedocker agent sharedocker agent evaldocker-agent-configdocker-agent-run此 skill 负责 Docker Agent 的集成面:使代理可被其他软件访问(),以容器镜像分发的方式通过 OCI 注册表分发代理(),以及证明代理在变更后仍然正常运行()。它假定代理配置已存在——编写配置请参阅 ,交互式/本地调用请参阅 。
docker agent servedocker agent sharedocker agent evaldocker-agent-configdocker-agent-runWhen to use this skill
何时使用此 skill
Activate this skill when:
- The user wants an agent reachable over MCP, an OpenAI-compatible chat endpoint, a plain HTTP API, or A2A/ACP.
- The user wants to publish an agent to Docker Hub (or any OCI registry) or pull one someone else published.
- The user wants automated evaluations (regression tests) for an agent, or wants to gate CI on eval results.
在以下情况激活此 skill:
- 用户希望通过 MCP、OpenAI 兼容的聊天端点、纯 HTTP API 或 A2A/ACP 使代理可被访问。
- 用户希望将代理发布到 Docker Hub(或任何 OCI 注册表),或拉取他人发布的代理。
- 用户希望为代理进行自动化评估(回归测试),或希望根据评估结果对 CI 进行门禁。
Do not use this skill when
何时不要使用此 skill
Do not use this skill when:
- The task is authoring the agent.yaml itself (models, toolsets, sub_agents) — use .
docker-agent-config - The task is running the agent interactively on a developer's machine, choosing /
--safety, or aliases — use--sandbox.docker-agent-run
在以下情况不要使用此 skill:
- 任务是编写 agent.yaml 本身(models、toolsets、sub_agents)——请使用 。
docker-agent-config - 任务是在开发者的机器上交互式运行代理、选择 /
--safety或别名——请使用--sandbox。docker-agent-run
Core guidance
核心指导
Serving an agent
服务代理
-
Five server modes, each with its own default loopback listen address — never expose any of them beyond loopback without authentication:
Mode Default listen Auth flag Has ?--safetyserve mcp127.0.0.1:8081(only with--auth-token)--httpYes (only with )--httpserve api127.0.0.1:8080--auth-tokenNo serve chat127.0.0.1:8083/--api-key--api-key-envYes serve a2a127.0.0.1:8082--auth-tokenYes serve acp(stdio only) n/a No bashdocker agent serve mcp ./agent.yaml --http --listen 127.0.0.1:9090 --auth-token "$TOKEN" -
defaults to stdio transport (for local clients like Claude Desktop); pass
serve mcponly when you need a network-reachable MCP endpoint, and set--httpwhenever you do.--auth-token -
Binding any server flag to a non-loopback address without an auth token/key is refused;exists to force it and must be treated as a deliberate, documented exception, never a default.
--insecure-no-auth -
(with
serve mcp),--http, andserve chatexposeserve a2a(--safety/strict/balanced/restricted); Docker's docs state it defaults toautonomousfor these modes when unset.restrictedandserve apiexpose noserve acpflag at all. Never raise--safetyto--safetyon a network-reachable listener; if a served agent must approve more, preferautonomousand keep auth enabled.balanced -
accepts a directory instead of a single file: every
serve api/.yaml/.ymlin it is exposed under.hcl. Use/api/agentsto confine session working directories when the server is reachable by more than one user.--session-workingdir-root
-
五种服务器模式,每种模式都有自己的默认回环监听地址——未经认证时,切勿将其中任何一个暴露到回环之外:
模式 默认监听地址 认证标志 是否有 ?--safetyserve mcp127.0.0.1:8081(仅配合--auth-token)--http是(仅配合 )--httpserve api127.0.0.1:8080--auth-token否 serve chat127.0.0.1:8083/--api-key--api-key-env是 serve a2a127.0.0.1:8082--auth-token是 serve acp(仅 stdio) 不适用 否 bashdocker agent serve mcp ./agent.yaml --http --listen 127.0.0.1:9090 --auth-token "$TOKEN" -
默认使用 stdio 传输(适用于 Claude Desktop 等本地客户端);仅当需要可通过网络访问的 MCP 端点时才传入
serve mcp,并且在这种情况下务必设置--http。--auth-token -
将任何服务器标志绑定到非回环地址时,如果没有认证令牌/密钥,会被拒绝;可用于强制绑定,但必须将其视为经过审慎考虑并有文档记录的例外情况,绝非常规默认。
--insecure-no-auth -
(配合
serve mcp)、--http和serve chat提供serve a2a(--safety/strict/balanced/restricted);Docker 文档说明,对于这些模式,若未设置,默认值为autonomous。restricted和serve api完全不提供serve acp标志。切勿在网络可达的监听器上将--safety提高到--safety;如果被服务的代理必须批准更多操作,请优先使用autonomous并保持认证启用。balanced -
接受目录而非单个文件:目录中的每个
serve api/.yaml/.yml都会在.hcl下暴露。当服务器可供多个用户访问时,使用/api/agents来限制会话工作目录。--session-workingdir-root
Sharing agents via OCI registries
通过 OCI 注册表分享代理
- Push and pull agent configs the same way you push and pull images — same
registry, same auth:
docker loginbashdocker agent share push ./agent.yaml docker.io/username/my-agent:latest docker agent share pull docker.io/username/my-agent:latest - contents are inlined into the pushed artifact automatically, so a published agent stays self-contained — you do not need to bundle the referenced files separately.
instruction_file - Pin that reference the pushed artifact to a digest (
sub_agents) once published, to avoid a per-run registry lookup and to guarantee the exact config a consumer gets.name@sha256:... - Use on
--forceonly when you intend to overwrite a local copy that already exists; without it, an existing local config is left untouched.share pull
- 像推拉镜像一样推拉代理配置——相同的注册表、相同的 认证:
docker loginbashdocker agent share push ./agent.yaml docker.io/username/my-agent:latest docker agent share pull docker.io/username/my-agent:latest - 的内容会自动内联到推送的制品中,因此发布的代理保持自包含——你无需单独打包引用的文件。
instruction_file - 发布后,将引用该推送制品的 固定到摘要(
sub_agents),以避免每次运行时的注册表查询,并确保消费者获得确切的配置。name@sha256:... - 仅当你打算覆盖已存在的本地副本时,才对 使用
share pull;若不使用,已有的本地配置将保持不变。--force
Evaluating agents
评估代理
- Evals live in an directory next to the agent config by default; each eval is one JSON session file capturing a user message, the recorded tool calls, and an
evals/object with the scoring criteria.evals - Create eval sessions from real conversations rather than hand-writing
JSON: run the agent interactively, then use the slash command in the TUI to save the session, and edit in
/eval/relevance/sizecriteria afterward.assertions - Four scoring dimensions: Tool Calls (F1 against the recorded sequence),
Relevance (LLM-judge, , default
--judge-model), Size (S/M/L/XL response-length bucket), and Assertions (deterministic checks; see the complete assertion-type list inanthropic/claude-opus-5). Prefer assertions overreferences/eval-format.mdwhen a check can be exact: they need no judge model and are deterministic, not approximation-prone.relevance - Evaluations run inside containers for isolation; a Docker-compatible
runtime is required. Dedicated provider API keys
(/
ANTHROPIC_API_KEY) are forwarded automatically.OPENAI_API_KEY/GITHUB_TOKENare not forwarded automatically (they're broad host credentials, not model keys) — pass them explicitly withGH_TOKENwhen an agent's provider needs one (e.g.-e GITHUB_TOKEN).github-copilot - Gate CI on regressions, not on absolute scores, with :
--baselineA previously-passing eval that now fails always gates regardless of tolerance; cost changes are reported but never gate. A baseline or run with zero evaluations (e.g. anbashdocker agent eval ./agent.yaml --baseline results/2026-08-01-run.json --regression-tolerance 0.05pattern matching nothing) is rejected rather than reported as passing.--only - Use plus your runtime's
--keep-containersto inspect a failed eval's container; the eval'sexecsession file holds the full conversation for offline debugging..db
- 默认情况下,评估(evals)位于代理配置旁边的 目录中;每次评估都是一个 JSON 会话文件,捕获用户消息、记录的工具调用以及包含评分标准的
evals/对象。evals - 从真实对话中创建评估会话,而不是手写 JSON:交互式运行代理,然后在 TUI 中使用 斜杠命令保存会话,之后编辑
/eval/relevance/size标准。assertions - 四个评分维度:工具调用(与记录序列的 F1)、相关性(LLM 评判,,默认
--judge-model)、大小(S/M/L/XL 响应长度桶)和断言(确定性检查;完整断言类型列表见anthropic/claude-opus-5)。当检查可以精确时,优先使用断言而非references/eval-format.md:断言不需要评判模型,且是确定性的,不会倾向于近似。relevance - 评估在容器内运行以实现隔离;需要与 Docker 兼容的运行时。专用的提供商 API 密钥(/
ANTHROPIC_API_KEY)会自动转发。OPENAI_API_KEY/GITHUB_TOKEN不会自动转发(它们是广泛的主机凭据,不是模型密钥)——当代理的提供商需要时(例如GH_TOKEN),请使用github-copilot显式传递。-e GITHUB_TOKEN - 使用 基于回归而非绝对分数对 CI 设门禁:
--baseline之前通过而现在失败的评估,无论容差如何,始终构成门禁;成本变化会被报告但不会构成门禁。评估次数为零的基线或运行(例如bashdocker agent eval ./agent.yaml --baseline results/2026-08-01-run.json --regression-tolerance 0.05模式未匹配到任何内容)会被拒绝,而不会被报告为通过。--only - 使用 加上运行时的
--keep-containers来检查失败评估的容器;评估的exec会话文件包含完整对话,可用于离线调试。.db
Verify
验证
- After changing a served agent's config, re-run its evals with the same
explicit value used in the deployment before restarting the listener — this catches an approval-policy regression before it reaches traffic. If a rollout must be rolled back, restore the prior config and safety flag; never restore an unauthenticated listener as a rollback shortcut.
--safety
- 更改被服务代理的配置后,在重新启动监听器之前,使用部署中相同的显式 值重新运行其评估——这能在审批策略回归影响流量之前捕获它。如果必须回滚发布,请恢复先前的配置和安全标志;切勿恢复未认证的监听器作为回滚捷径。
--safety
Related skills
相关 skills
- For writing or changing the underlying , use
agent.yaml.docker-agent-config - For local/interactive runs, safety-mode choice, and sandboxing, use .
docker-agent-run
- 如需编写或修改底层 ,请使用
agent.yaml。docker-agent-config - 如需本地/交互式运行、安全模式选择及沙箱,请使用 。
docker-agent-run
References
参考资料
- — full eval session JSON schema and CLI flag table.
references/eval-format.md - — provenance of every rule in this skill.
references/sources.md
- — 完整的评估会话 JSON 模式和 CLI 标志表。
references/eval-format.md - — 此 skill 中每条规则的来源。
references/sources.md
Assets
资源
- — a minimal eval session file to copy and adapt.
assets/eval-session-example.json
- — 一个可供复制和调整的最小评估会话文件。
assets/eval-session-example.json
Checks
检查
- — Verification runbook for serving, sharing, and evaluating an agent.
checks/verification.md
- — 用于服务、分享和评估代理的验证运行手册。
checks/verification.md