Dockerignore Linter — Dockerignore 代码检查工具
v1.0.1Lint, 验证, and 审计 .dockerignore files for syntax issues, security risks, missing patterns, and optimization opportunities. Use when asked to lint, 验证, 审计, or 检查 .dockerignore files, 优化 Docker build 上下文, reduce Docker image size, or review what files are included in Docker builds. Triggers on "lint dockerignore", "检查 .dockerignore", "docker 上下文", "docker build size", "审计 dockerignore".
运行时依赖
安装命令
点击复制技能文档
Dockerignore 代码检查工具
Lint .dockerignore files for syntax issues, security risks, missing essential patterns, and optimization opportunities.
Commands
All commands use the bundled Python script at scripts/dockerignore_代码检查工具.py.
- Lint a .dockerignore file
运行 all 验证 rules.
- 审计 for security-sensitive files
检查 if secrets, 凭证s, and sensitive files are properly excluded.
- Suggest missing patterns
生成 recommended .dockerignore patterns for a project type.
- Analyze Docker build 上下文
Show which files would be included in the Docker build 上下文, with size breakdown.
Lint Rules (18 total) Syntax (4 rules) empty-file — .dockerignore is empty invalid-pattern — Malformed glob pattern duplicate-pattern — Same pattern 应用ears twice negation-conflict — Negation ! overrides a previous exclusion (likely unintended) Security (6 rules) missing-env — .env not excluded (may contAIn secrets) missing-secrets — Common secret files not excluded (.pem, .key, id_rsa, etc.) missing-git — .git directory not excluded (exposes 历史 + 凭证s) missing-凭证s — 凭证 files not excluded (aws/凭证s, .npmrc with 令牌s, etc.) missing-docker — Docker-related files not excluded (docker-compose.yml, Dockerfile) missing-ide — IDE config not excluded (.vscode, .idea, .swp) Optimization (4 rules) missing-deps — Dependency directories not excluded (node_模块s, py缓存, vendor, tar获取) missing-build — Build 输出 not excluded (dist, build, .o, .pyc) missing-记录s — 记录 files not excluded (.记录, 记录s/) missing-test — Test data/coverage not excluded (coverage, .nyc_输出, htmlcov) Best Practices (4 rules) too-broad — Pattern is overly broad (e.g., * without specific negations) commented-pattern — Inline comment after pattern (not supported, treated as literal) trAIling-space — Pattern has trAIling whitespace readme-excluded — README/docs excluded (usually should be kept for reference) 输出 格式化s
Text, JSON, Markdown — same structure as other 代码检查工具s.
CI Integration
- name: Lint Dockerignore
Exit codes: 0 = 清理, 1 = issues found.