detect-docker-antipatterns
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "detect-docker-antipatterns" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-1b1e32bfb107d981151caf29ba9bfff0c3ba87d598442eb86d568b9d0c635191. Verify the upstream source and version against https://github.com/dykyi-roman/awesome-claude-code before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Detect Docker anti-patterns in a PHP project. Identify problematic image layer ordering, practices that break caching, build steps that bloat images, and configuration smell issues.
Introduction source: third_party · dykyi-roman · 0.0.1 Reference
SkillPi interpretation
- Tasks
- Detects Docker antipatterns in PHP projects. Identifies layer ordering issues, cache invalidation, bloated images, and configuration smells.
- Inputs and outputs
- ```markdown
- Testing
- Not tested
Browse files
Frontmatter
name: detect-docker-antipatterns
description: Detects Docker antipatterns in PHP projects. Identifies layer ordering issues, cache invalidation, bloated images, and configuration smells.Docker Antipattern Detection
Analyze Dockerfiles for antipatterns causing bloated images, poor caching, and unreliable builds.
Antipattern Catalog
1. COPY Before Dependency Install
# BAD: Cache busted on every code change
COPY . /var/www/html
RUN composer install --no-dev
# GOOD: Dependencies first, source second
COPY composer.json composer.lock /var/www/html/
RUN composer install --no-dev --no-scripts --no-autoloader
COPY . /var/www/html
RUN composer dump-autoload --optimize
2. apt-get update in Separate Layer
# BAD: Stale package index
RUN apt-get update
RUN apt-get install -y libpng-dev
# GOOD: Combined in same layer
RUN apt-get update && apt-get install -y --no-install-recommends \
libpng-dev && rm -rf /var/lib/apt/lists/*
3. Using latest Tag
# BAD: Non-deterministic builds
FROM php:latest
# GOOD: Pinned version
FROM php:8.4.3-fpm-bookworm
4. apt-get Without Cleanup
# BAD: Package cache bloats image
RUN apt-get update && apt-get install -y libzip-dev
# GOOD: Cleanup in same layer
RUN apt-get update && apt-get install -y --no-install-recommends \
libzip-dev && rm -rf /var/lib/apt/lists/*
5. Multiple FROM Without Multi-Stage Purpose
# BAD: Build artifacts never copied
FROM node:20
RUN npm ci && npm run build
FROM php:8.4-fpm
COPY . /var/www/html
# GOOD: Artifact copy from named stage
FROM node:20 AS frontend
RUN npm ci && npm run build
FROM php:8.4-fpm
COPY --from=frontend /app/dist /var/www/html/public
6. Unrelated Commands in Single RUN
# BAD: Mixed concerns, poor cache utilization
RUN apt-get update && pecl install redis && composer install
# GOOD: Logically grouped
RUN apt-get update && apt-get install -y --no-install-recommends \
libzip-dev && rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-install zip opcache
RUN pecl install redis && docker-php-ext-enable redis
7. No .dockerignore
# Required .dockerignore to exclude:
.git
.env
vendor
node_modules
tests
docs
docker-compose*.yml
8. Installing Editors in Production
# BAD: Dev tools in production
RUN apt-get install -y vim nano htop strace
# GOOD: Only runtime dependencies
RUN apt-get install -y --no-install-recommends libzip-dev
9. ADD Instead of COPY
# BAD: ADD has implicit tar extraction and URL fetching
ADD app.tar.gz /var/www/html/
# GOOD: Explicit COPY for local files
COPY . /var/www/html/
10. CMD with Shell Form
# BAD: Shell form (no signal forwarding)
CMD php-fpm -F
# GOOD: Exec form (PID 1 receives signals)
CMD ["php-fpm", "-F"]
11. ENTRYPOINT Not Handling Signals
# GOOD: Entrypoint with exec for signal forwarding
COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["php-fpm"]
Grep Patterns
Grep: "^COPY \\." --glob "**/Dockerfile*"
Grep: "^RUN apt-get update$" --glob "**/Dockerfile*"
Grep: "^FROM.*:latest" --glob "**/Dockerfile*"
Grep: "apt-get install" --glob "**/Dockerfile*"
Grep: "^ADD " --glob "**/Dockerfile*"
Grep: "^(CMD|ENTRYPOINT) [^\\[]" --glob "**/Dockerfile*"
Grep: "install.*-y.*(vim|nano|htop|strace)" --glob "**/Dockerfile*"
Glob: "**/.dockerignore"
Severity Classification
| Antipattern | Severity | Impact |
|---|---|---|
| COPY before deps install | Critical | Cache invalidation every build |
| Using latest tag | Critical | Non-reproducible builds |
| Installing editors | Major | Image bloat, attack surface |
| apt-get without cleanup | Major | +50-200MB image size |
| Shell form CMD | Major | No signal forwarding |
| ADD instead of COPY | Major | Unexpected behavior |
| Separate apt-get update | Major | Stale packages |
| No .dockerignore | Major | Large build context |
| Unrelated RUN commands | Minor | Poor cache utilization |
| Multiple FROM unused | Minor | Confusion, dead stages |
| No signal handling | Minor | Ungraceful shutdown |
Output Format
### Docker Antipattern: [Name]
**Severity:** Critical/Major/Minor
**File:** `Dockerfile:line`
**Category:** Cache / Size / Security / Reliability
**Issue:** [Description and why it is problematic]
**Fix:** [Corrected instruction snippet]
**Impact:** Build time / Image size / Reliability changesCurrent listing version
0.0.1
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 针对 PHP 项目的 Docker 反模式检测,具有明确的开发辅助价值
- 覆盖缓存失效、镜像臃肿、配置异味等常见痛点
Highlights
- 触发描述清晰明确,边界清晰,易于用户理解适用场景
Areas to improve
-
缺少 When to Use 章节 Reported severity: Minor
文档结构完整但未包含明确的 When to Use 使用场景说明章节
Recommendation: 建议补充 When to Use 章节,说明何时以及如何使用此 Skill
Highlights
- 反模式目录分类清晰,配有 BAD/GOOD 代码示例
- 提供 Grep 模式便于实际检测,输出格式标准化
Highlights
- Grep 命令参数正确,覆盖主要反模式场景
- 严重性分类合理,输出格式明确,便于集成到工作流
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Delete files
Confirm the absolute path and scope and keep a recoverable backup. Do not run example commands against important directories.
Mentioned in main document · lines 35, 56, 83 -
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 31, 34, 52, 55, 82
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.