openclaw-skills/docker-expert/SKILL.md
Use when containerizing an application with Docker, optimizing multi-stage builds and image size, designing Docker Compose services, troubleshooting container networking or volumes, or adding secure image build and CI/CD practices.
npx skillsauth add seaworld008/commonly-used-high-value-skills docker-expertInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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:
tools
飞书审批:查询和处理审批待办/已办/实例,搜索可发起审批定义、查看定义详情并发起原生审批实例。当用户要处理审批任务、查看审批实例、搜索或发起审批时使用。审批待办不是飞书任务;非审批类待办走 lark-task。不负责创建审批定义;三方审批定义不走原生提单。
development
Use when a user needs reproducible repository sizing, language composition, file counts, or code-versus-comment ratios with pygount; record exclusions and verify measurement scope before interpreting results.
development
Route a development task to the official Hermes Agent skill, Graphify Codex artifact set, Open GSD Core bundle, or optional GSD Pi bundle without duplicating their installers or state machines.
development
飞书 / Lark 通讯录:按姓名 / 邮箱解析成 open_id,或按 open_id 反查姓名 / 部门 / 邮箱 / 联系方式 / 个人状态 / 签名,以及按关键词搜索当前用户可见的机器人 / 智能体(agent)。当用户提到一个名字要下一步发消息 / 排日程,或拿到 open_id 想查具体信息时使用。不负责部门树遍历、按部门列员工、组织架构图,这类需求走原生 OpenAPI。