avibebuilder/claude-prime / .claude/starter-skills/docker
docker
VerifiedALWAYS activate when the user's query involves Docker in any way — even if it also matches other skills. If the words docker, Dockerfile, docker-compose, compose.yml, container, or image appear in the query, this skill MUST be used. Covers: writing or editing Dockerfiles and compose files, adding services (postgres, redis, etc.) to compose, volume mounts and data persistence, docker build failures (layer caching, npm install issues), healthchecks and service startup ordering (depends_on), environment variables in containers, port mapping, container crashes and exit codes (OOM/137), non-root users, multi-stage builds, image optimization, .dockerignore, and deploying to container runtimes. Takes priority over general implementation or debugging skills when Docker infrastructure is the subject.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 4.1 KB |
| references/compose.md | markdown | 1.7 KB |
| references/dockerfile.md | markdown | 2.4 KB |
| references/production.md | markdown | 2.3 KB |
| references/security.md | markdown | 1.3 KB |
references/dockerfile.md
View on GitHub# Dockerfile Reference
Efficient Dockerfiles minimize rebuild times through strategic layer ordering, multi-stage builds, and proper caching.
## Multi-Stage Builds
Separate build dependencies from runtime—only artifacts reach the final image.
```dockerfile
FROM node:18 AS builder
COPY package*.json ./
RUN npm ci && npm run build
FROM node:18-slim
COPY --from=builder /app/dist ./dist
CMD ["node", "dist/index.js"]
```
## Layer Caching Strategy
Order instructions least-to-most frequently changed. Docker caches layers based on instruction + content.
```dockerfile
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
```
Changing code only rebuilds final layers—package install is cached.
## COPY vs ADD
Use `COPY` for standard files (predictable, recommended). Use `ADD` only for tar archives or remote URLs.
```dockerfile
COPY ./config /app/
ADD archive.tar.gz /app/
```
## CMD vs ENTRYPOINT
**CMD**: Default command, overridable with `docker run image <cmd>`.
**ENTRYPOINT**: Fixed entry point, combined with CMD for flexible arguments.
```dockerfile
ENTRYPOINT ["python", "app.py"]
CMD ["--config", "default.yaml"]
# docker run image → python app.py --config default.yaml
# docker run image custom.yaml → python app.py custom.yaml
```
## ARG vs ENV
| | Scope | Timing | Use |
|---|-------|--------|-----|
| **ARG** | Build | Build-time | Conditional compilation |
| **ENV** | Image+Runtime | Persisted | Runtime defaults |
```dockerfile
ARG NODE_ENV=production
RUN if [ "$NODE_ENV" = "production" ]; then npm ci --prod; fi
ENV NODE_ENV=production
ENV LOG_LEVEL=info
# docker build --build-arg NODE_ENV=development .
```
## Combining RUN Instructions
Chain commands with `&&` to reduce layers and image size.
```dockerfile
# Inefficient: 3 layers
RUN apt-get update
RUN apt-get install -y curl
RUN rm -rf /var/lib/apt/lists/*
# Efficient: 1 layer
RUN apt-get update && \
apt-get install -y curl && \
rm -rf /var/lib/apt/lists/*
```
## Best Practices
- Order layers: stable (dependencies) → dynamic (source code)
- Use multi-stage builds to separate build from runtime
- Chain RUN with `&&` and `\` line continuation
- Prefer `COPY` over `ADD`
- Combine `ENTRYPOINT` + `CMD` for flexible overrides
- Use `ARG` for build-time decisions, `ENV` for runtime
- Place frequently-changing instructions last for cache efficiency
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |