joabgonzalez/ai-agents-skills/docker
Claude Code and agent skill by joabgonzalez/ai-agents-skills
- community
Checking that the SKILL.md file is still in the repository.
Docker patterns: multistage builds, security hardening, and compose. Trigger: When writing Dockerfiles, docker-compose, or containerizing apps.
Install
npx vskill@latest install joabgonzalez/ai-agents-skills/dockerSKILL.md
The same SKILL.md was published earlier as joabgonzalez/ai-agents-skills/docker.
Docker
Patterns for writing production-ready Dockerfiles and Compose configurations: minimal images, security hardening, layer caching, and health checks.
When to Use
- Writing or reviewing a Dockerfile
- Setting up docker-compose for local dev or deployment
- Containerizing a Node.js app (examples use Node.js; patterns apply to any runtime)
- Optimizing image size or build time
Don't use for:
- Kubernetes manifests (separate concern)
- CI/CD pipeline configuration
- Cloud-specific container registries
Critical Patterns
✅ REQUIRED [CRITICAL]: Multistage Builds
Separate build dependencies from the runtime image. Final image ships only what runs.
✅ REQUIRED [CRITICAL]: Non-Root User
Containers run as root by default. A compromised container = root on the host namespace.
✅ REQUIRED: Pin Base Image Versions
latest changes without warning and breaks reproducible builds.
✅ REQUIRED: Layer Cache Order — Dependencies Before Source
Copy dependency manifests first, install, then copy source. Source changes don't bust the dep cache.
✅ REQUIRED: .dockerignore
Exclude everything not needed in the build context. Prevents secrets and node_modules from leaking in.
✅ REQUIRED: Health Checks
Without a health check, orchestrators can't distinguish a crashed app from a starting one.
❌ NEVER: Secrets in Dockerfile or Build Args
ARG values appear in image history. ENV is readable from any running container.
Decision Tree
Example
Production Node.js Dockerfile with multistage, non-root user, and health check.
Edge Cases
Alpine vs Debian: Alpine uses musl libc — some npm packages with native bindings (sharp, canvas) require Debian-based images (node:20-slim). Check if npm ci fails on alpine before committing to it.
Python apps: Use python:3.12-slim as runtime base. Layer cache order: COPY requirements.txt → RUN pip install --no-cache-dir -r requirements.txt → COPY . .. Use virtual env in multistage: python -m venv /opt/venv in builder, COPY --from=builder /opt/venv /opt/venv in runtime.
Multi-platform builds: Use docker buildx build --platform linux/amd64,linux/arm64 for M1/M2 Mac compatibility with AMD64 deployment targets.
Large monorepos: Copy only the workspace package that's being built. Use .dockerignore aggressively to reduce build context size.
Read-only filesystem: For hardened deployments, add --read-only at runtime and mount writable tmpfs only where needed (/tmp, /var/run).
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/docker/SKILL.md
Popularity
- Repository stars
- 9
- 7-day trend score
- 12
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/joabgonzalez/ai-agents-skills/docker)