Docker Development
Dockerfile Best Practices
- Multi-stage builds (separate build and runtime)
- Minimal base images (alpine when possible)
- Non-root user inside container
- .dockerignore for node_modules, .git, etc
- Layer caching: COPY package*.json first, then npm install, then COPY code
Docker Compose
- Named volumes for persistent data
- Environment variables via .env file
- Health checks for dependencies
- Restart policies (unless-stopped)
- Network isolation between services
Common Stack
services:
app: # Application
db: # PostgreSQL/MongoDB
redis: # Cache/queues
minio: # Object storage (dev)
Use this skill with your AI agent:
Open on Skill Issue to copy, download, or add to your library.
Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.