用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/seaworld008/Commonly-used-high-value-skills --skill docker-expert命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | docker-expert |
| description | 用于 Docker 容器化最佳实践、多阶段构建优化与 Docker Compose 编排。来源:skills.sh 8.7K installs。 |
| zh_description | 用于 Docker 容器化最佳实践、多阶段构建优化与 Docker Compose 编排。 |
| version | 1.0.0 |
| author | seaworld008 |
| source | skills.sh |
| source_url | https://skills.sh/sickn33/antigravity-awesome-skills/docker-expert |
| license | CC-BY-4.0 |
| tags | ["development", "docker", "expert"] |
| created_at | 2026-03-27 |
| updated_at | 2026-03-27 |
| quality | 4 |
| complexity | intermediate |
AS 关键字定义多个阶段。在第一阶段进行源码编译、依赖安装;在第二阶段仅拷贝最终产物(如编译后的二进制文件或静态资源)到轻量级基础镜像(如 Alpine 或 Distroless)中。RUN 指令,清理构建过程中的临时文件(如 npm cache clean, apt-get clean)。package.json, go.mod),运行安装命令,最后再拷贝源代码。这能显著提高后续构建速度。alpine, slim 版本,或 Google 的 distroless 镜像以降低攻击面。.git, node_modules, tests, docs),减小上传给 Docker daemon 的上下文体积。depends_on 及其 condition: service_healthy(结合 healthcheck)确保依赖服务就绪后再启动主应用。docker-compose.override.yml 或 env_file 实现不同环境的差异化配置。bridge(默认隔离)、host(无隔离,高性能)、none 及自定义 overlay 网络。bind mounts(挂载主机目录,常用于开发)和 named volumes(由 Docker 管理,常用于生产)。USER 指令切换到非特权用户。docker scan (Snyk), Trivy 或 Clair 检查镜像中的已知 CVE。--cpus, --memory,防止容器资源耗尽攻击(DoS)。--cache-from 提升流水线中的镜像构建速度。docker login, push 流程。# 查看容器资源占用 (CPU, Memory, Network)
docker stats --no-stream
# 进入运行中的容器排查网络
docker exec -it <container_id> /bin/sh -c "ping db_host && nslookup api_service"
# 清理所有未使用的镜像、容器、卷和网络(一键释放磁盘)
docker system prune -af --volumes
# 查看镜像层级与体积详情
docker history <image_name>
# 阶段 1: 构建 (Build)
FROM node:20-alpine AS builder
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN npm install -g pnpm && pnpm install --frozen-lockfile
COPY . .
RUN pnpm build
# 阶段 2: 运行 (Production)
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV production
# 拷贝构建产物
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
# 创建非 root 用户并切换
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=3s \
CMD wget --quiet --tries=1 --spider http://localhost:3000/health || exit 1
CMD ["node", "dist/main.js"]
version: '3.8'
services:
web:
build: .
ports:
- "80:3000"
environment:
- DB_URL=postgres://user:pass@db:5432/mydb
depends_on:
db:
condition: service_healthy
networks:
- frontend
- backend
db:
image: postgres:16-alpine
volumes:
- db_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
networks:
- backend
networks:
frontend:
backend:
internal: true # 限制后端网络不可访问外网
volumes:
db_data:
Multi-agent collaboration plugin that spawns N parallel subagents competing on the same task via git worktree isolation. Agents work independently, results are evaluated by metric or LLM judge, and the best branch is merged. Use when: user wants multiple approaches tried in parallel — code optimization, content variation, research exploration, or any task that benefits from parallel competition. Requires: a git repo.
Design production-grade multi-agent orchestration systems. Covers five core patterns (sequential pipeline, parallel fan-out/fan-in, hierarchical delegation, event-driven, consensus), platform-specific implementations, handoff protocols, state management, error recovery, context window budgeting, and cost optimization.
App Store Optimization toolkit for researching keywords, optimizing metadata, and tracking mobile app performance on Apple App Store and Google Play Store.
基于 SOC 职业分类