跳到主内容
智客 ZICQ

技能库 智客分类:运维与云 docker

Docker

构建,运行,调试,管理多克容器,图像,作曲文件,网络,卷,注册,Buildx/Bake,Scout/SBOM,Swarm,和多克AI工具. 当用户提到嵌入器、容器、容器、多克文件、作曲、图像注册、卷或任何嵌入器子命令时使用.

29 安装量

官方网址:skills.sh

技能介绍

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

做什么

构建、运行、调试和管理 Docker 容器、图像、编译文件、网络、卷、注册、 Buildx/Bake、 Scout/SBOM、 Swarm 和 Docker AI 工具

何时用

用户提及嵌入器、容器、容器、容器、嵌入器文件、绘图、图像注册、卷或任何嵌入器子命令

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Docker、Quick Start、Intent Router (Progressive Disclosure)、Quick Command Reference、Container lifecycle、Images。

文件分析

文件分析:除 SKILL.md 外,正文引用了 scripts/probe-docker.ps1、assets/templates/、scripts/doctor-docker.ps1,属于带资源的技能包,这些文件按需再读。

官方 description(原文)

Build, run, debug, and manage Docker containers, images, compose files, networking, volumes, registries, Buildx/Bake, Scout/SBOM, Swarm, and Docker AI tooling. Use when the user mentions docker, containers, containerizing, Dockerfile, compose, image registry, volumes, or any docker subcommand.

DockerQuick StartIntent Router (Progressive Disclosure)Quick Command ReferenceContainer lifecycleImagesCompose (v2 — no hyphen)Buildx / multi-platformSystemSafety MatrixWriting DockerfilesDocker Compose Authoring

· 许可:MIT

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
docker
description
Build, run, debug, and manage Docker containers, images, compose files, networking, volumes, registries, Buildx/Bake, Scout/SBOM, Swarm, and Docker AI tooling. Use when the user mentions docker, containers, containerizing, Dockerfile, compose, image registry, volumes, or any docker subcommand.
许可
MIT
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。
指令中引用的文件 · 3
  • scripts/probe-docker.ps1
  • assets/templates/
  • scripts/doctor-docker.ps1

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

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

安装这个技能

Skills CLI ↗

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

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

交给 Agent 安装

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

把 Agent Skill「docker」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-06f53acef667dc66-%E5%A4%B9%E5%85%8B.html
请存为 .cursor/skills/docker/SKILL.md 或 .claude/skills/docker/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/greedychipmunk/agent-skills 取完整目录,不要只建一个 SKILL.md。

GitHub 完整包 ↗

终端安装 · Skills CLI

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

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

npx skills add 'https://github.com/greedychipmunk/agent-skills' --skill 'docker'

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

阅读排版
--- name: docker description: Build, run, debug, and manage Docker containers, images, compose files, networking, volumes, registries, Buildx/Bake, Scout/SBOM, Swarm, and Docker AI tooling. Use when the user mentions docker, containers, containerizing, Dockerfile, compose, image registry, volumes, or any docker subcommand. license: MIT metadata: author: greedychipmunk version: "1.0" --- # Docker Use this skill to keep Docker work deterministic, safe, and fast across Linux, macOS, and Windows Docker Desktop hosts. ## Quick Start 1. Run `scripts/probe-docker.ps1` (Windows) or `docker info` / `docker version` (Linux/macOS) first for environment truth. 2. Choose the smallest workflow that solves the request: - Core container/build/compose workflow in this file covers ~80% of tasks. - Load a reference file only when you need depth on a specific domain. - Reuse `assets/templates/` starter packs before writing boilerplate from scratch. 3. Default to read-only diagnostics before proposing mutating commands. 4. Confirm before destructive commands (`rm`, `prune`, `down -v`, `sandbox reset`, builder/cache deletion). 5. Prefer installed CLI behavior when docs and runtime diverge; note the caveat with concrete versions. ## Intent Router (Progressive Disclosure) Load only the reference file needed for the active request. - `resources/install-and-setup.md` — Installing Docker Desktop (macOS/Windows) or Docker Engine (Linux), and post-install configuration. - `resources/core.md` — Windows Desktop-first diagnostics, context management, Desktop status. - `resources/containers.md` — `run/exec/logs/inspect/debug/stats` and crash triage. - `resources/images.md` — Dockerfile authoring, multi-stage patterns, Buildx/Bake. - `resources/compose.md` — Compose authoring and service orchestration. - `resources/networking.md` — bridge/overlay/macvlan, DNS, port publishing. - `resources/volumes.md` — named volumes, bind mounts, backup/restore patterns. - `resources/registry.md` — login/tag/push/pull and registry hygiene. - `resources/swarm.md` — swarm init, services, stacks, safe operations. - `resources/troubleshooting.md` — systematic debugging and error classification. - `resources/security.md` — Scout, SBOM, DHI, pass secrets, supply chain checks. - `resources/ai-and-agents.md` — Docker AI, agent/cagent, MCP toolkit, model runner, sandbox. - `resources/cloud-and-remote.md` — Offload, Build Cloud, remote builders and contexts. ## Quick Command Reference These cover ~80% of daily Docker use. Use them directly without loading a reference file. ```bash # Container lifecycle docker run -d --name myapp -p 8080:80 nginx # Run detached with port mapping docker run -it --rm ubuntu bash # Interactive, auto-remove on exit docker ps # List running containers docker ps -a # All containers (incl. stopped) docker stop myapp && docker rm myapp # Stop and remove docker logs myapp -f # Follow logs docker logs myapp --tail=100 # Last 100 lines docker exec -it myapp bash # Shell into running container docker inspect myapp # Full metadata (JSON) docker stats # Live resource usage # Images docker build -t myapp:latest . # Build from Dockerfile in cwd docker pull nginx:alpine # Pull image docker images # List local images docker rmi myapp:latest # Remove image docker tag myapp:latest myregistry/myapp:v1.2 # Tag for push # Compose (v2 — no hyphen) docker compose config # Validate and view merged config docker compose up -d # Start all services detached docker compose down # Stop and remove containers+networks docker compose logs -f api # Follow logs for one service docker compose exec api sh # Shell into service container docker compose ps # Service status docker compose build --no-cache # Rebuild all images # Buildx / multi-platform docker buildx ls docker buildx build --platform linux/amd64,linux/arm64 -t myorg/myapp:v1 --push . # System docker system df # Disk usage breakdown docker system prune # Remove unused objects (see safety) ``` ## Safety Matrix | Command or Pattern | Required Guardrail | | --- | --- | | `docker system prune` / `prune -a` | Run `docker system df` first; summarize what will be removed, then confirm. | | `docker volume rm` | Warn that volume data is permanently deleted and require explicit confirmation. | | `docker network rm` | Check for attached containers first and list impacted services before remove. | | `docker rm -f` | Confirm exact container names; avoid bulk force-remove without listing targets. | | `docker rmi -f` | Check container/image dependents first and confirm impact. | | `docker swarm leave --force` | Explain manager impact and require explicit confirmation. | | `docker compose down -v` | Call out database/state loss risk and require explicit confirmation. | | `docker sandbox reset` | Treat as destructive reset; require explicit confirmation. | | `docker push` to registry | Confirm the full destination tag before pushing. | | `--privileged` flag | Explain what it grants and why it's risky before using. | ## Writing Dockerfiles When asked to write a Dockerfile, always apply these best practices by default: - **Layer order** — put things that change least at the top (base image, system deps), most at the bottom (app code). Maximizes cache reuse. - **Multi-stage builds** — compile/install in a build stage; copy only artifacts to a minimal runtime image. - **Non-root user** — create and switch to a non-root user before CMD. - **Minimal base image** — prefer `alpine`, `distroless`, or `slim`. Use full images only when system packages are needed. - **Combine RUN commands** — chain related commands with `&&`; clean up package caches in the same layer. - **Always create `.dockerignore`** alongside Dockerfile. For complete Dockerfile templates (Node.js, Python, Go) and `.dockerignore` patterns, see `resources/images.md`. ## Docker Compose Authoring Key patterns for compose files: - Use `condition: service_healthy` on `depends_on` when the dependency has a healthcheck. - Always define named volumes rather than bare bind mounts for data you care about. - Scope services to internal-only networks when they don't need external access. - Use `restart: unless-stopped` for production; omit for dev tooling containers. - Set an explicit `name:` at the top to avoid directory-name collisions. For complete compose file templates with health checks, see `resources/compose.md`. ## Diagnostic Workflow When a container is crashing or misbehaving: ```bash docker ps -a # Find container and exit code docker logs --tail=100 # Last 100 lines (stderr included with 2>&1) docker inspect # Full JSON — check State, Config, Mounts docker stats --no-stream # Snapshot of memory/CPU (check for OOM) docker exec -it sh # Shell in (if still running) docker debug # Debug sidecar, works on stopped containers docker compose ps && docker compose logs --tail=50 # Compose: all services at once ``` Exit codes: `0` = clean exit, `1` = app error, `137` = OOM killed, `139` = segfault, `143` = SIGTERM, `125/126/127` = Docker/exec errors. ## Core Workflow (Windows Desktop) 1. **Establish baseline** — Run `scripts/probe-docker.ps1 -Json` for structured diagnostics (CLI version, context, plugin availability, daemon reachability). 2. **Diagnose before changing state** — Run `scripts/doctor-docker.ps1` for actionable checks. Use `-Quick` for fast triage; `-IncludeScout` / `-IncludeOffload` only when in scope. 3. **Execute scoped operations** — container lifecycle, build pipeline, compose orchestration, context/Desktop checks. 4. **Report findings by root cause** — sandbox/host permission boundary, daemon/service state, config mismatch. ## Resource Index - `scripts/probe-docker.ps1` — `probe-docker.ps1 [-Json] [-IncludeExperimental]` — read-only host/runtime probe. - `scripts/doctor-docker.ps1` — `doctor-docker.ps1 [-Quick] [-IncludeOffload] [-IncludeScout]` — diagnostics and recommendations. - `assets/templates/` — reusable starter packs for minimal service, compose stack, and multi-arch Buildx. - `resources/*.md` — deep domain coverage (see Intent Router above).

相关技能

运维与云

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 部署命令带有内置…