📦 containerlint — Docker安全扫描器
v1.0.1一键扫描 Dockerfile 与容器镜像,自动发现安全反模式:缺失健康检查、资源限制、特权容器、暴露密钥等风险,并给出修复建议,让容器上线即安全。
0· 0·0 当前·0 累计
by @suhteevah
运行时依赖
无特殊依赖
安装命令
点击复制官方npx clawhub@latest install containerlint
镜像加速npx clawhub@latest install containerlint --registry https://cn.longxiaskill.com
技能文档
概述
containerlint 是一个 Docker 和容器安全反模式分析工具,帮助开发者识别容器配置中的安全问题。
功能特性
- Dockerfile 安全分析
- 容器运行时配置检查
- 最佳实践建议
- 支持 CI/CD 集成
使用方法
# 分析当前目录的 Dockerfile containerlint analyze# 指定 Dockerfile 路径 containerlint analyze -f /path/to/Dockerfile
# 输出 JSON 格式 containerlint analyze --json
检查规则
| 规则 ID | 严重程度 | 描述 |
|---|---|---|
| DL3001 | 高 | 不推荐使用 pipe 作为 Dockerfile RUN 命令的输入 |
| DL3002 | 高 | 最后一个 USER 指令不应为 root |
| DL3015 | 中 | 避免额外安装 APKBUILD 依赖 |
集成示例
GitHub Actions
- name: Run containerlint
uses: hadolint/containerlint-action@v1
GitLab CI
containerlint:
image: hadolint/containerlint
script:
- containerlint analyze
配置
在项目根目录创建 .containerlint.yaml 配置文件:
rules:
DL3001: error
DL3002: warn
DL3015: info
ignore:
- "/test/"