plugins/backend-and-infra/skills/docker-patterns/SKILL.md
Docker and Docker Compose reference patterns for local development, container security, networking, volume strategies, and multi-service orchestration. Complements docker-compose-setup (scaffolding) with best-practice reference.
npx skillsauth add arosenkranz/claude-code-config docker-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Reference guide for Docker and Docker Compose best practices. Use alongside /docker-compose-setup for scaffolding.
# Stage: dependencies
FROM node:22-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
# Stage: dev (hot reload)
FROM node:22-alpine AS dev
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
EXPOSE 3000
CMD ["npm", "run", "dev"]
# Stage: production (minimal image)
FROM node:22-alpine AS production
WORKDIR /app
RUN addgroup -g 1001 -S appgroup && adduser -S appuser -u 1001
USER appuser
COPY --from=build --chown=appuser:appgroup /app/dist ./dist
COPY --from=build --chown=appuser:appgroup /app/node_modules ./node_modules
ENV NODE_ENV=production
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http://localhost:3000/health || exit 1
CMD ["node", "dist/server.js"]
Services in the same Compose network resolve by service name:
postgres://postgres:postgres@db:5432/app_dev
redis://redis:6379/0
services:
frontend:
networks: [frontend-net]
api:
networks: [frontend-net, backend-net]
db:
networks: [backend-net] # Only reachable from api
volumes:
- .:/app # Bind mount for hot reload
- /app/node_modules # Protect container deps from host
- pgdata:/var/lib/postgresql/data # Named volume for persistence
docker compose up # Auto-loads override (dev)
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d # Production
:latest)security_opt: [no-new-privileges:true]read_only: true with tmpfs for writable dirscap_drop: [ALL], add back only what's needed.env files or Docker secrets127.0.0.1 only when not needed on networklinux/arm64 (check Docker Hub tags)deploy.resources.limits.memory: 256Mplatform: linux/arm64 in compose to catch mismatches earlydocker compose logs -f app # Follow logs
docker compose exec app sh # Shell in
docker compose exec db psql -U postgres
docker compose ps # Running services
docker stats # Resource usage
docker compose down -v # Stop + remove volumes (DESTRUCTIVE)
docker system prune # Clean unused images
tools
Lightweight orchestrator for spec-before-plan workflow. Use when starting a feature with ambiguous requirements. Walks SPEC.md → PLAN.md → execute, delegating to /superpowers:writing-plans and /superpowers:executing-plans. Invoke when asked to "spec this out", "spec-first", "spec and plan for X", or when feature requirements are vague.
tools
Problem Statement Co-Authoring Skill
development
Structure and maintain professional brag documents with clear templates for accomplishments, projects, and growth tracking. Use when documenting achievements, creating brag document entries, formatting accomplishments, or tracking career progress.
development
Analyze technical documentation for clarity, conciseness, and effectiveness using Google Technical Writing principles. Use when reviewing documentation, checking writing quality, improving docs, or providing writing feedback.