From agent-almanac
Configures Docker Compose stacks for web apps with Postgres, Redis, caches, workers, volumes, networks, health checks, depends_on, and profiles. Use for dev environments, multi-service orchestration, or reproducible setups.
npx claudepluginhub pjt222/agent-almanacThis skill uses the workspace's default tool permissions.
---
Generates Docker Compose configurations for multi-container apps with services, networks, volumes, health checks, dependencies, and environment setup. Useful for dev/prod orchestration.
Generates production-ready Docker Compose configurations for multi-container apps with health checks, networks, volumes, service dependencies, and examples for Node, Postgres, Redis, Nginx stacks.
Provides Docker Compose configurations and best practices for PHP stacks including Nginx, PHP-FPM, Redis, PostgreSQL, RabbitMQ, Elasticsearch, health checks, networking, and env management.
Share bugs, ideas, or general feedback.
Configure Docker Compose for multi-service application stacks with databases, caches, and workers.
services:
app:
build:
context: .
dockerfile: Dockerfile
ports:
- "3000:3000"
environment:
DATABASE_URL: postgres://appuser:apppass@postgres:5432/appdb
REDIS_URL: redis://redis:6379
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_started
restart: unless-stopped
postgres:
image: postgres:16
environment:
POSTGRES_DB: appdb
POSTGRES_USER: appuser
POSTGRES_PASSWORD: apppass
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U appuser -d appdb"]
interval: 5s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- redisdata:/data
volumes:
pgdata:
redisdata:
Expected: docker compose up starts all services with the app waiting for a healthy database.
Health checks enable depends_on with condition: service_healthy:
services:
postgres:
healthcheck:
test: ["CMD-SHELL", "pg_isready -U appuser -d appdb"]
interval: 5s
timeout: 5s
retries: 5
redis:
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
app:
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
services:
app:
networks:
- frontend
- backend
postgres:
networks:
- backend
nginx:
networks:
- frontend
ports:
- "80:80"
networks:
frontend:
driver: bridge
backend:
driver: bridge
This isolates the database from direct external access while the app bridges both networks.
Create .env file (git-ignored):
POSTGRES_PASSWORD=secure_password_here
APP_SECRET=your_secret_key
Reference in compose:
services:
postgres:
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
app:
env_file:
- .env
Create .env.example (committed to git):
POSTGRES_PASSWORD=changeme
APP_SECRET=changeme
services:
worker:
build:
context: .
dockerfile: Dockerfile
command: ["node", "src/worker.js"]
environment:
DATABASE_URL: postgres://appuser:apppass@postgres:5432/appdb
REDIS_URL: redis://redis:6379
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_started
restart: unless-stopped
deploy:
replicas: 2
services:
app:
# always starts
build: .
mailhog:
image: mailhog/mailhog
ports:
- "8025:8025"
profiles:
- dev
adminer:
image: adminer
ports:
- "8080:8080"
profiles:
- dev
# Start core services only
docker compose up
# Start with dev tools
docker compose --profile dev up
docker-compose.override.yml is auto-merged:
services:
app:
build:
target: dev
volumes:
- .:/app
- /app/node_modules
environment:
NODE_ENV: development
DEBUG: "app:*"
command: ["npm", "run", "dev"]
# Build all images
docker compose build
# Start in background
docker compose up -d
# View logs
docker compose logs -f app
# Check service status
docker compose ps
# Stop and remove
docker compose down
# Stop and remove volumes (full reset)
docker compose down -v
Expected: All services start, health checks pass, app connects to database and cache.
On failure: Check docker compose logs <service>. Common issues: port conflicts, missing environment variables, health check timeouts.
docker compose up starts all services without errors.env is git-ignored; .env.example is committeddocker compose down cleanly stops everythingdepends_on without condition: service_healthy only waits for container start, not readiness..env files or Docker secrets. Never commit passwords..:/app overwrites node_modules built in the image. Use an anonymous volume: /app/node_modules.docker compose ps and lsof -i :<port> for conflicts.version: key: Compose V2 ignores the version: key. Omit it for modern setups./mnt/c/... paths when mounting Windows directories from WSL.setup-docker-compose - R-specific Docker Compose configurationscreate-dockerfile - write the Dockerfile that compose referencescreate-multistage-dockerfile - build optimized images for the stackconfigure-nginx - add an Nginx reverse proxy to the stack