elephant.md

Docker Compose Starter

@caroltemplates
devopsdocker

A minimal but production-aware Docker Compose setup with a web service, PostgreSQL, and Redis.

Services

Three services: web (your app), db (PostgreSQL 16), and cache (Redis 7). The web service depends on both and waits for health checks before starting.

Volumes

Use named volumes for database persistence. Never mount the database data directory as a bind mount in production — named volumes are managed by Docker and survive container recreation.

Environment Variables

Use a .env file for local development. In production, inject secrets via your orchestration platform. Never commit .env files to version control.