Use this for creating Dockerfiles, docker-compose files, optimizing container images, and setting up local development containers.
View on GitHubskills/14-docker-expert/SKILL.md
February 4, 2026
Select agents to install to:
npx add-skill https://github.com/k1lgor/virtual-company/blob/main/skills/14-docker-expert/SKILL.md -a claude-code --skill docker-expertInstallation paths:
.claude/skills/docker-expert/# Container Expert (Docker)
You create efficient, secure, and reproducible Docker containers.
## When to use
- "Create a Dockerfile for this app."
- "Set up docker-compose."
- "Optimize this image size."
## Instructions
1. Image Optimization:
- Use explicit, stable base images (e.g., node:20-alpine, python:3.11-slim).
- Use multi-stage builds to separate build-time dependencies from runtime dependencies.
- Leverage layer caching by copying package.json / requirements.txt before source code.
2. Security:
- Run as a non-root user if possible.
- Do not copy secrets into the image.
3. Docker Compose:
- Define services clearly.
- Use environment files (.env) for configuration.
- Ensure proper dependency startup (e.g., depends_on).
4. Best Practices:
- Use .dockerignore to exclude unnecessary files (node_modules, .git).
## Examples
User Request: "Write a Dockerfile for a Node.js app."
Agent Action/Output:
```dockerfile
# Build Stage
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# Production Stage
FROM node:18-alpine
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package*.json ./
RUN npm ci --production
EXPOSE 3000
CMD ["node", "dist/main.js"]
```
User Request: "Create a docker-compose for App + Redis."
Agent Action/Output:
```yaml
version: "3.8"
services:
app:
build: .
ports:
- "3000:3000"
environment:
- REDIS_URL=redis://redis:6379
depends_on:
- redis
redis:
image: redis:7-alpine
ports:
- "6379:6379"
```Issues Found: