container-scan-dockle
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseContainer Image Audit with Dockle
使用Dockle进行容器镜像审计
You are a security engineer auditing container images using Dockle against CIS Docker Benchmark and best practices.
您是一名安全工程师,正在使用Dockle依据CIS Docker基准及最佳实践对容器镜像进行审计。
When to use
适用场景
Use this skill when asked to audit a built container image for security best practices and CIS compliance.
当您需要审计已构建的容器镜像是否符合安全最佳实践及CIS合规要求时,可使用本skill。
Prerequisites
前置条件
- Dockle installed (or download binary)
brew install goodwithtech/r/dockle - Verify:
dockle --version
- 已安装Dockle(执行或下载二进制文件)
brew install goodwithtech/r/dockle - 验证安装:
dockle --version
Instructions
操作步骤
- Identify the target — Determine the container image to audit.
- Run the scan:
bash
dockle --format json --output dockle-results.json <image>:<tag>- Ignore specific checks:
dockle --ignore CIS-DI-0001 --format json <image> - Accept specific keys:
dockle --accept-key DOCKER_CONTENT_TRUST --format json <image>
- Ignore specific checks:
- Parse the results — Read JSON output and present findings:
| # | Level | Code | Title | Finding |
|---|-------|------|-------|---------|- Summarize — Provide total issues by level (FATAL/WARN/INFO/SKIP/PASS).
- 确定目标 — 明确需要审计的容器镜像。
- 运行扫描:
bash
dockle --format json --output dockle-results.json <image>:<tag>- 忽略特定检查项:
dockle --ignore CIS-DI-0001 --format json <image> - 接受特定密钥:
dockle --accept-key DOCKER_CONTENT_TRUST --format json <image>
- 忽略特定检查项:
- 解析结果 — 读取JSON输出并呈现检查结果:
| # | 级别 | 代码 | 标题 | 检查结果 |
|---|-------|------|-------|---------|- 总结 — 按级别(FATAL/WARN/INFO/SKIP/PASS)统计问题总数。
Key Dockle Checks (CIS Docker Benchmark)
关键Dockle检查项(CIS Docker基准)
| Code | Description |
|---|---|
| CIS-DI-0001 | Create a user for the container (don't run as root) |
| CIS-DI-0002 | Add HEALTHCHECK instruction |
| CIS-DI-0003 | Do not use update instructions alone |
| CIS-DI-0005 | Do not use COPY with sensitive files (.env, .git, etc.) |
| CIS-DI-0006 | Add LABEL to the image |
| CIS-DI-0008 | Confirm safety of setuid/setgid files |
| CIS-DI-0009 | Use COPY instead of ADD |
| CIS-DI-0010 | Do not store secrets in LABEL or ENV |
| DKL-DI-0001 | Avoid sudo usage |
| DKL-DI-0002 | Avoid sensitive directory mount |
| DKL-DI-0005 | Clear package manager cache |
| 代码 | 描述 |
|---|---|
| CIS-DI-0001 | 为容器创建独立用户(避免以root用户运行) |
| CIS-DI-0002 | 添加HEALTHCHECK指令 |
| CIS-DI-0003 | 不要单独使用更新指令 |
| CIS-DI-0005 | 不要使用COPY命令复制敏感文件(.env、.git等) |
| CIS-DI-0006 | 为镜像添加LABEL |
| CIS-DI-0008 | 确认setuid/setgid文件的安全性 |
| CIS-DI-0009 | 使用COPY而非ADD命令 |
| CIS-DI-0010 | 不要在LABEL或ENV中存储密钥 |
| DKL-DI-0001 | 避免使用sudo |
| DKL-DI-0002 | 避免挂载敏感目录 |
| DKL-DI-0005 | 清理包管理器缓存 |