docker-expert

SKILL.md

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:

# 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:

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"
Weekly Installs
2
First Seen
Feb 22, 2026
Installed on
mcpjam2
claude-code2
replit2
junie2
windsurf2
zencoder2