Docker Compose YAML Examples

Production-ready docker-compose.yml configurations covering single-service development setups and full multi-service stacks with Nginx, PostgreSQL, and Redis.

About Docker Compose

Docker Compose is a tool for defining and running multi-container applications. The docker-compose.yml (or compose.yml in modern Compose v2) file describes your services, networks, and volumes as declarative YAML. Run docker compose up -d and Compose brings up every service in the correct order, creates the shared network, and mounts the volumes — all in one command.

Compose is particularly valuable for local development (every developer runs the same environment with a single command) and for staging environments where you want a production-like setup without the overhead of Kubernetes. The examples here show patterns used across thousands of real-world projects — from a minimal web app with a database, to a full production-style stack with an Nginx reverse proxy, Redis cache, and service health checks ensuring startup order.

Examples

🐘

Single Service

Web app with PostgreSQL: health-check-aware dependency ordering, named volumes, and the node_modules volume trick for local development.

docker-compose.yml
🏗️

Full Stack

Nginx reverse proxy, web app, PostgreSQL, and Redis with health checks, restart policies, and .env variable substitution.

docker-compose.yml

🛠 Paste this YAML into the validator to check it instantly.

Open Validator →

Browse all categories

GitHub Actions · GitLab CI · CircleCI · Bitbucket Pipelines · Docker Compose · Kubernetes · Helm · Ansible