Get practical Docker and Compose patterns for secure local multi-service development.
Copy the install command and let the AI configure it · recommended for beginners
Please install the "docker-patterns" skill from askskill: 1. Download https://raw.githubusercontent.com/affaan-m/ECC/main/skills/docker-patterns/SKILL.md 2. Save it as ~/.claude/skills/docker-patterns/SKILL.md 3. Reload skills and tell me it's ready
Design a Docker Compose setup for a project with frontend, backend, and PostgreSQL for local development. It should support hot reload, environment variable management, service dependencies, and separate dev/prod configs. Include a sample folder structure and configuration.
A practical Compose architecture with service layout, sample configs, and local development best practices.
Review this Dockerfile and Compose configuration. Suggest improvements for least privilege, image size, secret handling, user permissions, read-only filesystem, and network isolation, then provide revised examples.
A security hardening checklist plus revised Dockerfile and Compose configuration examples.
I have a containerized project with an app service, Redis, and a database. Compare bind mounts, named volumes, and tmpfs, then design suitable networking and data persistence strategies for local development and testing.
A clear comparison of volume types, recommended network topology, and persistence strategies for different environments.
Docker and Docker Compose best practices for containerized development.
# docker-compose.yml
services:
app:
build:
context: .
target: dev # Use dev stage of multi-stage Dockerfile
ports:
- "3000:3000"
volumes:
- .:/app # Bind mount for hot reload
- /app/node_modules # Anonymous volume -- preserves container deps
environment:
- DATABASE_URL=postgres://postgres:postgres@db:5432/app_dev
- REDIS_URL=redis://redis:6379/0
- NODE_ENV=development
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
command: npm run dev
db:
image: postgres:16-alpine
ports:
- "5432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: app_dev
volumes:
- pgdata:/var/lib/postgresql/data
- ./scripts/init-db.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 3s
retries: 5
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- redisdata:/data
mailpit: # Local email testing
image: axllent/mailpit
ports:
- "8025:8025" # Web UI
- "1025:1025" # SMTP
volumes:
pgdata:
redisdata:
# Stage: dependencies
FROM node:22-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
# Stage: dev (hot reload, debug tools)
FROM node:22-alpine AS dev
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
EXPOSE 3000
CMD ["npm", "run", "dev"]
# Stage: build
FROM node:22-alpine AS build
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build && npm prune --production
# 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
COPY --from=build --chown=appuser:appgroup /app/package.json ./
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"]
# docker-compose.override.yml (auto-loaded, dev-only settings)
services:
app:
environment:
- DEBUG=app:*
- LOG_LEVEL=debug
ports:
- "9229:9229" # Node.js debugger
# docker-compose.prod.yml (explicit for production)
services:
app:
build:
target: production
restart: always
deploy:
resources:
limits:
cpus: "1.0"
memory: 512M
# Development (auto-loads override)
docker compose up
# Production
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
Services in the same Compose network resolve by service name:
# From "app" container:
postgres://postgres:postgres@db:5432/app_dev # "db" resolves to the db container
redis://redis:6379/0 # "redis" resolves to the redis container
services:
frontend:
networks:
- frontend-net
api:
networks:
- frontend-net
- backend-net
db:
networks:
…
Audit production readiness locally and uncover risks before or after release.
Fetches up-to-date framework docs for setup, APIs, and code examples.
Write, review, and refactor C++ with modern, safe, idiomatic standards.
Apply consistent Java coding standards for Spring Boot and Quarkus services.
Turn a plan document into stepwise /orchestrate prompts and agent chains.
Apply Spring Boot security best practices for authentication, authorization, and service hardening.
Safely orchestrate Docker tasks and build reproducible development stack environments.
Design reliable deployment workflows, CI/CD pipelines, and production release strategies.
Learn Django architecture, DRF API design, and production-ready development practices.
Generate, audit, and optimize Docker Compose stacks inside Claude Code.
Inspect containers, images, and configs to speed up Docker troubleshooting.
Manage and orchestrate Docker environments remotely with natural language commands.