跳到主内容
智客 ZICQ

技能库 智客分类:安全测试 docker-development

Docker Development

用于任何多克任务:写出多克文件,配置多克-组成/组成.yml,多相建构,多克-bake.hcl,容器安全审核,.dockerignore优化,或CI/CD容器测试. 触发器:多克文件,多克-编曲,容器,图像构建,多相,多相,多克烘焙,作曲.

403 安装量

官方网址:skills.sh

技能介绍

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

做什么

用于任何多克任务:写出多克文件,配置多克-组成/组成.yml,多相建构,多克-bake.hcl,容器安全审核,.dockerignore优化,或CI/CD容器测试. 触发器:多克文件,多克-编曲,容器,图像构建,多相,多相,多克烘焙,作曲.

何时用

与任何 Docker 任务合作: 写 Docker files, 配置 Docker-compose/ compose.yml, 多级构建, docker-bake.hcl, 容器安全审核,. dockerignore 优化, 或 CI/CD 容器测试. 触发器: Dockerfile、 Docker- 编组、 容器、 图像构建、 粘土

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Docker Development、Core Principles、Quick Reference、Multi-Stage Build (Node.js)、Multi-Stage Build (Go -- scratch/distroless)、Layer Optimization。

文件分析

文件分析:除 SKILL.md 外,正文引用了 references/build-secret-leaks.md、references/bind-mount-ownership.md、references/ci-testing.md、references/dind-testing-patterns.md、references/gpg-verification.md、references/registry-catalogue-and-pin-rot.md,属于带资源的技能包,这些文件按需再读。

官方 description(原文)

Use when working with ANY Docker task: writing Dockerfiles, configuring docker-compose/compose.yml, multi-stage builds, docker-bake.hcl, container security audits, .dockerignore optimization, or CI/CD container testing. Triggers on: Dockerfile, docker-compose, container, image build, multi-stage, docker bake, compose.

Docker DevelopmentCore PrinciplesQuick ReferenceMulti-Stage Build (Node.js)Multi-Stage Build (Go -- scratch/distroless)Layer OptimizationBuild Cache: Copy Dependency Files FirstBuildKit SecretsDocker Bake (Multi-Platform)Security Anti-PatternsCI Testing Gotchas.dockerignore

兼容:Requires docker, docker compose. · 许可:(MIT AND CC-BY-SA-4.0)

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
docker-development
description
Use when working with ANY Docker task: writing Dockerfiles, configuring docker-compose/compose.yml, multi-stage builds, docker-bake.hcl, container security audits, .dockerignore optimization, or CI/CD container testing. Triggers on: Dockerfile, docker-compose, container, image build, multi-stage, docker bake, compose.
compatibility
Requires docker, docker compose.
许可
(MIT AND CC-BY-SA-4.0)
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。
指令中引用的文件 · 7
  • references/build-secret-leaks.md
  • references/bind-mount-ownership.md
  • references/ci-testing.md
  • references/dind-testing-patterns.md
  • references/gpg-verification.md
  • references/registry-catalogue-and-pin-rot.md
  • references/php-fpm-worker-starvation.md

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

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

安装这个技能

Skills CLI ↗

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

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

交给 Agent 安装

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

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

GitHub 完整包 ↗

终端安装 · Skills CLI

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

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

npx skills add 'https://github.com/netresearch/docker-development-skill' --skill 'docker-development'

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

阅读排版

name: docker-development description: "Use when working with ANY Docker task: writing Dockerfiles, configuring docker-compose/compose.yml, multi-stage builds, docker-bake.hcl, container security audits, .dockerignore optimization, or CI/CD container testing. Triggers on: Dockerfile, docker-compose, container, image build, multi-stage, docker bake, compose." license: "(MIT AND CC-BY-SA-4.0)" compatibility: "Requires docker, docker compose." metadata: version: "1.15.2" repository: "https://github.com/netresearch/docker-development-skill" author: "Netresearch DTT GmbH" allowed-tools:

  • "Bash(docker:*)"
  • "Bash(grep:*)"
  • "Read"
  • "Write"
  • "Glob"
  • "Grep"

Docker Development

Core Principles

  1. Minimal -- Alpine/distroless, multi-stage
  2. Secure -- Non-root USER, no layer secrets, pin versions
  3. Testable -- entrypoint bypass, DNS mocking
  4. Cache-efficient -- deps first, clean in-layer

Quick Reference

Multi-Stage Build (Node.js)

FROM node:24-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .

FROM node:24-alpine
RUN addgroup -g 1001 app && adduser -u 1001 -G app -D app
USER app
COPY --from=builder /app .
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
  CMD wget -qO- http://localhost:3000/health || exit 1
CMD ["node", "server.js"]

Multi-Stage Build (Go -- scratch/distroless)

FROM golang:1.26-alpine AS builder
WORKDIR /app
COPY go.* ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -o /app/server .

FROM gcr.io/distroless/static:nonroot
COPY --from=builder /app/server /server
CMD ["/server"]

Layer Optimization

RUN apt-get update && \
    apt-get install -y --no-install-recommends curl && \
    rm -rf /var/lib/apt/lists/*

Build Cache: Copy Dependency Files First

COPY package*.json ./
RUN npm ci
COPY . .

Manifests before source keeps install layers cached.

BuildKit Secrets

RUN --mount=type=secret,id=ssh_key,dst=/root/.ssh/id_rsa git clone [email protected]:org/repo.git

ARG leaks via docker history and SLSA provenance -- references/build-secret-leaks.md

Docker Bake (Multi-Platform)

target "app" {
  platforms = ["linux/amd64", "linux/arm64"]
  cache-from = ["type=gha"]
  cache-to = ["type=gha,mode=max"]
}

Security Anti-Patterns

| Anti-pattern | Fix | |---|---| | FROM image:latest | Pin version: image:1.2.3-alpine | | No USER directive | adduser + USER appuser | | chmod 777 | Use specific permissions: chmod 550 | | privileged: true in compose | Remove or use specific cap_add | | volumes: [/:/host] | Mount only needed paths | | ports: ["0.0.0.0:3000:3000"] | Bind to 127.0.0.1:3000:3000 | | ENV DB_PASSWORD=secret | Use --mount=type=secret or compose secrets |

CI Testing Gotchas

  1. Bypass entrypoint: docker run --rm --entrypoint php myimage -v
  2. Mock upstream DNS: docker run --rm --add-host backend:127.0.0.1 nginx-image nginx -t
  3. Compose validation: cp .env.example .env before docker compose config
  4. Secret scanning: exclude .env.example, README, docs
  5. Root-owned artifacts: bind-mount dirs (EACCES) -- references/bind-mount-ownership.md

.dockerignore

Exclude: .git, node_modules/vendor, .env*, *.pem, *.key

Compose Essentials

  • startup ordering: depends_on.condition: service_healthy + healthcheck start_period
  • networks.internal: true isolates databases
  • profiles: [debug]: start only with --profile debug
  • shared image ref: define ONCE per file as top-level extension field + anchor -- x-app-image: &app-image registry/app:${APP_IMAGE_VERSION:-85}, services use image: *app-image. The field must sit ABOVE services: — an alias is only valid after its anchor in document order. :- defaults cover unset AND empty vars (a bare omitted tag silently resolves :latest). Anchors are file-local: every overlay file needs its own. Verify both paths: APP_IMAGE_VERSION= docker compose config and with an override

References

  • references/ci-testing.md -- CI testing patterns for Docker images
  • references/dind-testing-patterns.md -- Docker-in-Docker testing patterns
  • references/bind-mount-ownership.md -- root-owned bind-mount artifacts
  • references/gpg-verification.md -- gpgv patterns; stale keybox locks
  • references/registry-catalogue-and-pin-rot.md -- catalogue probes; pin rot
  • references/build-secret-leaks.md -- ARG in provenance
  • references/php-fpm-worker-starvation.md -- keepalive pins php-fpm

相关技能

安全测试

Skill Vetter

人工智能特工的安全第一技能审查。 在安装来自 ClawdHub, GitHub 或其他来源的任何技能之前使用 。 检查红旗,许可范围,可疑图案.

安全测试

Moltguard

MoltGuard——由OpenGuardrails担任OpenClaw保安. 安装 MoltGuard 以保护你和你的人类免受迅速注射、数据过滤和恶意命令的影响。 资料来源:https://github.com/openguardrails/openguardrails/tre…

安全测试

Security Auditor

用于审查安全漏洞代码,实施认证流,审计OWASP Top 10,配置CORS/CSP头,处理秘密,输入验证,SQL注射预防,XSS保护,或任何与安全相关的代码审查.

安全测试

Skill Vetter

安装任何AI代理技能前的安全审查协议. 红旗侦取入证盗取,疏通密码,放出. 风险分类:低/中/高/高。 编制结构化审查报告。 不先运行此功能, 绝不安装不信任的技能 .