← 返回
未分类 中文

Docker Compose Linter

Lint docker-compose.yml files for security, best practices, and port conflicts.
检查 docker-compose.yml 文件的安全问题、最佳实践和端口冲突
charlie-morrison charlie-morrison 来源
未分类 clawhub v1.0.1 1 版本 100000 Key: 无需
★ 0
Stars
📥 412
下载
💾 1
安装
1
版本
#latest

概述

docker-compose-linter

A pure Python 3 (stdlib only) linter for docker-compose.yml files.

Commands

python3 scripts/docker-compose-linter.py <command> [options] FILE
CommandDescription
--------------------------------------------------------------
lintLint a docker-compose.yml for issues
servicesList all services with their images/builds
portsList all port mappings, detect conflicts
auditFull audit (lint + services + ports summary)

Options

OptionDescription
---------------------------------------------------------------------------------
`--format text\json\markdown`Output format (default: text)
--strictExit 1 on any issue (not just errors)
--ignore RULEIgnore a specific rule (repeatable)
`--min-severity error\warning\info`Minimum severity to report (default: info)

Lint Rules

RuleSeverityDescription
-------------------------------------------------------------------------------------------
no-versioninfoMissing or outdated version: key
no-healthcheckwarningService without healthcheck defined
no-restart-policywarningService without restart policy
privileged-modeerrorService running in privileged mode
port-conflicterrorMultiple services mapping to same host port
host-networkwarningUsing network_mode: host (security risk)
latest-tagwarningImage using :latest tag or no tag
no-resource-limitsinfoNo memory/CPU limits (deploy.resources)
hardcoded-envwarningSecrets/passwords directly in environment variables
root-userwarningNo user: specified (runs as root by default)
missing-depends-oninfoService uses links but no depends_on
bind-mount-relativeinfoRelative bind mount paths
no-logginginfoNo logging configuration
duplicate-serviceerrorDuplicate service names

Examples

# Lint with default text output
python3 scripts/docker-compose-linter.py lint docker-compose.yml

# Only show errors and warnings
python3 scripts/docker-compose-linter.py --min-severity warning lint docker-compose.yml

# JSON output for CI pipelines
python3 scripts/docker-compose-linter.py --format json lint docker-compose.yml

# Full audit in markdown
python3 scripts/docker-compose-linter.py --format markdown audit docker-compose.yml

# Ignore specific rules
python3 scripts/docker-compose-linter.py --ignore root-user --ignore no-logging lint docker-compose.yml

# Strict mode: exit 1 on any issue
python3 scripts/docker-compose-linter.py --strict lint docker-compose.yml

Requirements

  • Python 3.7+
  • No external dependencies (pure stdlib)

版本历史

共 1 个版本

  • v1.0.1 当前
    2026-05-07 06:41 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 201 📥 68,573
dev-programming

YouTube

byungkyu
使用托管OAuth集成YouTube Data API,支持搜索视频、管理播放列表、获取频道数据及评论互动,适用于用户需要时使用此技能。
★ 142 📥 42,398
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 689 📥 332,743