跳到主内容
智客 ZICQ

技能库 智客分类:运维与云 docker-sandboxes-network-credentials

Docker Sandboxes Network Credentials

当配置一个多克沙盒('sbx')沙盒可以在网络上到达什么或者它认证的证书时使用此技能,即使用户只是说他们想要"让代理给一个内部的API","封锁所有的网络访问","让代理给一个GitHub令牌",或者"为沙盒使用私人注册图像". 涵盖`sbx policy init/allow/deny/ls/inspect/log/check/rm network'(全球和每箱互换规则,否定超低优先)和`sbx secret set/set-cust/ls/rm/import'(通过 --ref/-command的服务秘密、动态秘密,以及登记人凭其主机-推-只按默认注射范围提取证书).

1130 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

当配置一个多克沙盒('sbx')沙盒可以在网络上到达什么或者它认证的证书时使用此技能,即使用户只是说他们想要"让代理给一个内部的API","封锁所有的网络访问","让代理给一个GitHub令牌",或者"为沙盒使用私人注册图像". 涵盖`sbx policy init/allow/deny/ls/inspect/log/check/rm network'(全球和每箱互换规则,否定超低优先)和`sbx secret set/set-cust/ls/rm/import'(通过 --ref/-command的服务秘密、动态秘密,以及登记人凭其主机-推-只按默认注射范围提取证书).

何时用

这个技能

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Docker Sandboxes: Network Policy & Credentials、Overview、When to use this skill、Do not use this skill when、Core guidance、Network policy: global, per-sandbox, and precedence。

文件分析

文件分析:除 SKILL.md 外,正文引用了 references/sources.md,属于带资源的技能包,这些文件按需再读。

官方 description(原文)

Use this skill when configuring what a Docker Sandboxes (`sbx`) sandbox can reach on the network or which credentials it authenticates with, even if the user just says they want to "let the agent call an internal API", "block all network access", "give the agent a GitHub token", or "use a private registry image for a sandbox". Covers `sbx policy init/allow/deny/ls/inspect/log/check/rm network` (global and per-sandbox egress rules, deny-over-allow precedence) and `sbx secret set/set-custom/ls/rm/import` (service secrets, dynamic secrets via --ref/--command, and registry pull credentials with their host-pulls-only-by-default injection scope).

Docker Sandboxes: Network Policy & CredentialsOverviewWhen to use this skillDo not use this skill whenCore guidanceNetwork policy: global, per-sandbox, and precedenceService secrets: how injection worksRegistry credentials: host-pulls-only by default, two distinct injection scopesRelated skillsReferencesAssetsChecks

兼容:Standalone `sbx` CLI (not the legacy `docker sandbox` plugin wrapper). Source-verified against repository docker/sandboxes (github.com/docker/sandboxes) @ commit df5c96ba60484fa2c375469dbac912c205da6c37. Cross-checked against an installed sbx v0.42.0-503-g951b7f6d7 (commit 951b7f6d7f6bb260fac15077b607109ffe8ae012, older than the pinned source); no source-only differences were found for the commands this skill covers. `docker_help` does not cover standalone `sbx` syntax. · 许可:Apache-2.0

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
docker-sandboxes-network-credentials
description
Use this skill when configuring what a Docker Sandboxes (`sbx`) sandbox can reach on the network or which credentials it authenticates with, even if the user just says they want to "let the agent call an internal API", "block all network access", "give the agent a GitHub token", or "use a private registry image for a sandbox". Covers `sbx policy init/allow/deny/ls/inspect/log/check/rm network` (global and per-sandbox egress rules, deny-over-allow precedence) and `sbx secret set/set-custom/ls/rm/import` (service secrets, dynamic secrets via --ref/--command, and registry pull credentials with their host-pulls-only-by-default injection scope).
compatibility
Standalone `sbx` CLI (not the legacy `docker sandbox` plugin wrapper). Source-verified against repository docker/sandboxes (github.com/docker/sandboxes) @ commit df5c96ba60484fa2c375469dbac912c205da6c37. Cross-checked against an installed sbx v0.42.0-503-g951b7f6d7 (commit 951b7f6d7f6bb260fac15077b607109ffe8ae012, older than the pinned source); no source-only differences were found for the commands this skill covers. `docker_help` does not cover standalone `sbx` syntax.
许可
Apache-2.0
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。
指令中引用的文件 · 1
  • references/sources.md

以下路径提取自原文;文件是否齐全请以来源仓库中的完整目录为准。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

该技能引用了附属文件,请从来源获取完整目录;仅复制 SKILL.md 可能缺少依赖。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「docker-sandboxes-network-credentials」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-e36135e5ca54117d-Docker-Sandboxs-%E7%BD%91%E7%BB%9C%E8%AF%81%E4%B9%A6.html
请存为 .cursor/skills/docker-sandboxes-network-credentials/SKILL.md 或 .claude/skills/docker-sandboxes-network-credentials/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/docker/skills 取完整目录,不要只建一个 SKILL.md。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/docker/skills' --list

npx skills add 'https://github.com/docker/skills' --skill 'docker-sandboxes-network-credentials'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: docker-sandboxes-network-credentials description: Use this skill when configuring what a Docker Sandboxes (`sbx`) sandbox can reach on the network or which credentials it authenticates with, even if the user just says they want to "let the agent call an internal API", "block all network access", "give the agent a GitHub token", or "use a private registry image for a sandbox". Covers `sbx policy init/allow/deny/ls/inspect/log/check/rm network` (global and per-sandbox egress rules, deny-over-allow precedence) and `sbx secret set/set-custom/ls/rm/import` (service secrets, dynamic secrets via --ref/--command, and registry pull credentials with their host-pulls-only-by-default injection scope). license: Apache-2.0 compatibility: Standalone `sbx` CLI (not the legacy `docker sandbox` plugin wrapper). Source-verified against repository docker/sandboxes (github.com/docker/sandboxes) @ commit df5c96ba60484fa2c375469dbac912c205da6c37. Cross-checked against an installed sbx v0.42.0-503-g951b7f6d7 (commit 951b7f6d7f6bb260fac15077b607109ffe8ae012, older than the pinned source); no source-only differences were found for the commands this skill covers. `docker_help` does not cover standalone `sbx` syntax. --- # Docker Sandboxes: Network Policy & Credentials ## Overview This skill owns `sbx policy` (network egress) and `sbx secret` (service secrets and registry credentials). The proxy enforces egress policy and injects stored credentials on matching domains. Proxy-managed sentinels are not usable upstream credentials, but OAuth passthrough can expose real tokens to the sandbox. Egress policy does not protect a real credential once leaked outside the sandbox; revoke or rotate a leaked credential. ## When to use this skill Activate this skill when: - The user wants to allow, deny, or inspect which hosts a sandbox (or all sandboxes) can reach. - The user wants to give an agent an API key, OAuth token, or other service credential without exposing the raw value inside the sandbox. - The user wants to pull a private template image or kit from a registry that requires authentication. - The user is debugging a blocked network request or a credential that isn't being injected. ## Do not use this skill when Do not use this skill when: - The task is running `docker agent run --sandbox` or managing its `docker agent sandbox` allowlist — use `docker-agent-run`. If the CLI is unclear, establish whether the user runs Docker Agent or standalone `sbx` before choosing commands. - The task is creating, reattaching to, or removing a sandbox itself — use `docker-sandboxes-lifecycle`. - The task is declaring secrets/registries/bindings inside a checked-in `sbxenv.yaml` file — use `docker-sandboxes-env` for the file format (this skill's rules on precedence and injection scope still apply to what that file provisions). - The task is declaring a kit's own `credentials:`/`permissions.network:` block in a `spec.yaml` — use `docker-sandboxes-kits` for the schema (this skill's model of what those declarations mean at runtime still applies). ## Core guidance ### Network policy: global, per-sandbox, and precedence - The global network policy must be initialized once before creating the first sandbox: `sbx policy init `. `balanced` is the recommended starting point (typical dev traffic — AI services, package registries — allowed). This is a one-time setup. - **`sbx policy reset` is destructive: it deletes the entire local policy store and stops the daemon and every currently running sandbox.** The daemon restarts on the next daemon-backed command. It is not a lightweight way to "start over" or a routine diagnostic step — never propose it as a first troubleshooting move for a single misbehaving rule. Use targeted `sbx policy rm network` (by `--id` or `--resource`) to remove one rule instead; reserve `sbx policy reset` for when the policy store itself needs to be rebuilt from scratch, and warn the user that it will stop running sandboxes before running it. - Add rules with `sbx policy allow network RESOURCES` / `sbx policy deny network RESOURCES`. `RESOURCES` is a comma-separated list of exact hosts, `*.example.com` single-label wildcards, `**.example.com` multi-label wildcards, optional `:port` suffixes, CIDR prefixes, or `**` for "all hosts". ```bash sbx policy init balanced sbx policy allow network "api.example.com,cdn.example.com" sbx policy deny network ads.example.com ``` - **Deny always wins over allow** for the same hostname/CIDR when both match. An allowed hostname is not checked against CIDR deny rules for its resolved IP. - A rule applies globally by default. Pass `--sandbox NAME` to scope it to one sandbox's local policy instead: ```bash sbx policy allow network --sandbox my-sandbox api.example.com ``` - At **creation time only**, `sbx create`/`sbx run` accept `--deny-network RESOURCE` (repeatable) to add a per-sandbox deny rule. This is safe to expose even under centralized (org) governance because a local deny can only narrow, never widen, egress — it can never override an org-level allow into a broader grant. - Use `sbx policy check network [--sandbox NAME] TARGET` to test what the **current** policy would do for a host/URL before it matters, and `sbx policy log [SANDBOX]` to see what was actually allowed or blocked historically, with the matching rule. ```bash sbx policy check network --sandbox my-sandbox api.example.com:443 sbx policy log my-sandbox --json ``` - `sbx policy ls [SANDBOX] [--wide]` lists active policies/rules; `--wide` adds rule IDs (needed for `sbx policy rm network --id`) and per-resource status. `sbx policy inspect ` gives full detail including each rule's exact removal command or the reason it is read-only (e.g. org-managed). To remove a sandbox-scoped rule, retain `--sandbox NAME`; omitting it targets the global policy instead: ```bash sbx policy rm network --sandbox my-sandbox --resource api.example.com sbx policy check network --sandbox my-sandbox api.example.com ``` Removing one rule does not determine the final decision; other matching rules still apply. ### Service secrets: how injection works - `sbx secret set [SERVICE]` stores a credential the **proxy** uses to authenticate outbound requests on behalf of the agent. In the normal proxy-managed flow, the sandbox sees a sentinel rather than the raw secret; the proxy substitutes the real value on requests to the domains the matching kit/binding declares. ```bash sbx secret set github # interactive printf '%s' "$ANTHROPIC_API_KEY" | sbx secret set anthropic ``` **Storing a secret does not grant network access.** Egress is governed separately by `sbx policy`; check the target domain in the intended scope before debugging authentication: ```bash sbx policy check network --sandbox my-sandbox api.anthropic.com ``` - **OAuth passthrough is an exception, not a no-secret-exposure guarantee.** When a kit sets `oauth.passthrough: true` without a refresh sentinel, the proxy forwards the real token response to the sandbox. The built-in `devin` kit uses this mode. Review the agent's credential configuration before promising that it cannot read a token; do not enable passthrough merely to bypass an authentication failure. Even with sentinels, the agent can exercise the credential's permissions on allowed services — restrict token privileges as well as network access. - Service secrets are global by default; `--sandbox NAME` scopes one to a single sandbox. - **Dynamic secrets** resolve the value on the host at use time instead of storing it directly: `--ref` (1Password `op://...` or an AWS Secrets Manager ARN — requires an authenticated `op`/`aws` CLI) or `--command` (runs a shell command and uses its stdout). `--refresh` controls the resolution/cache policy (default `55m`, or `on-demand`). ```bash sbx secret set anthropic --ref 'op://Private/Anthropic/api-key' sbx secret set github --command 'gh auth token' ``` **`--command` and `--ref` are resolved on the host, with your own privileges, and treated as trusted execution** — never point `--command` at anything an untrusted file or an agent's own output could influence. - **Never pass a secret as a plain `--env` value or as a `--kit-arg` / `--env-arg` value.** Both land as literal, unmasked text — in the sandbox's environment, in `sbx env plan`'s state file, and potentially in shell history — defeating the entire point of the credential store. Use `sbx secret set` (or `sbxenv.yaml`'s `secrets:`/`registries:` blocks, which route through the same store) instead. - `sbx secret set-custom` (experimental) covers a service sbx has no built-in support for: the sandbox sees a placeholder value in an env var you name (`--env`), and the proxy swaps in the real secret only on requests to the `--host` pattern(s) you declare. - `sbx secret ls [--global|--sandbox NAME] [--service NAME] [--json]` lists what is stored, without revealing values. `sbx secret rm [SERVICE] [--sandbox NAME] [--all|--registry HOST] [--force]` removes it. - `sbx secret import [SERVICE] [--all] [--dry-run] [--force]` offers to import secrets already sitting in host environment variables (e.g. `OPENAI_API_KEY`, `GH_TOKEN`) into the global store, prompting per entry unless `--all`/`--force`. A service with an OAuth token already configured is skipped — OAuth takes precedence at runtime over an imported API key. ### Registry credentials: host-pulls-only by default, two distinct injection scopes - `sbx secret set --registry HOST --password-stdin` (optionally `--username`) stores **pull** credentials for a container registry, used to pull private template images and kit artifacts. **Unlike service secrets, registry credentials are host-only by default: they authenticate pulls on the host and are never injected into any sandbox.** ```bash gh auth token | sbx secret set --registry ghcr.io --password-stdin ``` - **`--all-sandboxes` and `--sandbox` widen this differently — do not confuse them:** - `--all-sandboxes`: credentials are used for host pulls **and** injected by the proxy into **every new sandbox's** registry login (the credential itself never enters the sandbox filesystem). - `--sandbox NAME`: credentials are injected into **that one sandbox only**. - Neither flag: host-pulls-only, injected nowhere. ```bash gh auth token | sbx secret set --all-sandboxes --registry ghcr.io --password-stdin gh auth token | sbx secret set --sandbox my-sandbox --registry ghcr.io --password-stdin ``` - For a registry whose Bearer auth endpoint lives on a different hostname than the registry itself, pass `--registry-auth-endpoint` naming the exact trusted HTTPS URL — otherwise the cross-host token exchange is rejected. - `sbx secret rm --registry HOST --sandbox NAME` removes only that sandbox's registry credential; host-only and global (all-sandboxes) entries are untouched. This does not revoke the upstream token or prevent use of another applicable credential. ```bash sbx secret rm --registry ghcr.io --sandbox my-sandbox ``` - Without `--sandbox`, `sbx secret rm --registry HOST` removes both the host-only and global entries. Add `--all-sandboxes` to remove only the global entry instead. ## Related skills - For `docker agent run --sandbox` and `docker agent sandbox` commands, use `docker-agent-run`. - For creating, reattaching to, and removing the sandboxes these policies and secrets apply to, use `docker-sandboxes-lifecycle`. - For declaring `secrets:`/`registries:`/`bindings:` inside a checked-in `sbxenv.yaml` file that provisions them at environment-create time, use `docker-sandboxes-env`. - For a kit's own `credentials:` and `permissions.network:` declarations (what a kit *asks for*, as opposed to what the user has *approved*), use `docker-sandboxes-kits`. ## References - `references/sources.md` — provenance for every rule above (help captures, source paths, docs URLs). ## Assets - None. ## Checks - `checks/verification.md` — Verification runbook for network policy and secret commands (unexecuted runbook; run manually with an isolated `--app-name`, no real secret values).

相关技能

运维与云

Docker Essentials

用于容器管理,图像操作,调试的基本道克命令和工作流程.

运维与云

Find Skills

从开放的代理技能生态系统中发现并安装技能. 使用时:(1)用户问"我如何做X",X可能拥有现有技能,(2)用户说"为X找到技能"或"是否为X有技能",(3)用户问"你能否做X",X是专门能力,(4)用户想扩展代理能力,(5)用户想搜索工具,模板,或工作流程,(6)用户提到他们希望…

运维与云

Microsoft Foundry

构建,部署,评价,优化,微调,管理微软创始代理,模型,资源最终结束. 用法:铸造、azd ai代理、azd 提供/部署、托管代理脚手架/开发/运行/部署/拖放、即时代理创建、创建代理、更新代理、添加代理工具、援引代理、代理.yaml、评估代理、批量活化、连续活化、持续监测、代理C…

运维与云

Azure Deploy

执行已有.azure/部署计划.md和基础设施文件的ALREADY-PREPARED应用程序的Azure部署。 当用户向 CREATE 请求新应用程序时, 请不要使用此技能 。 这种技能运行了 azd上行, azd 部署, trarraform 应用, 和 az 部署命令带有内置…