OhMySkills
基础设施与运维 docker-hardening 更新于 2026-11-06

Docker 工程规则

Production Dockerfile rules: minimal multi-stage images and non-root runtime

技术栈
Docker
主题
工程基线
条目
9 条
版本
v0.2.0

✓ 应当这么做

  • ✓ Use multi-stage builds and copy only runtime artifacts into the final image
  • ✓ Run as a non-root user and pin base images by digest for reproducibility
  • ✓ Mount secrets at runtime instead of baking them into layers

✕ 常见反模式

  • ✕ `latest` tags in production deployments
  • ✕ Build credentials present in intermediate layers
  • ✕ Running the application as PID 1 without a signal-aware entrypoint

◎ 交付前验证

  • ◎ Image scanned and no new critical CVEs introduced
  • ◎ Container exits cleanly on SIGTERM within the grace period
  • ◎ Final image size compared against the previous build

同分类条目

38 篇

同一技术栈的其他条目