Docker Compose generator
Build a docker-compose.yml for your app and the services it needs. Databases come with health checks, volumes and connection URLs already wired in.
What you get
- Services to add: Postgres, MySQL, MariaDB, MongoDB, Redis, Memcached, Elasticsearch, RabbitMQ and Mailpit.
- Your app waits for each service to be healthy (depends_on with a health condition) and gets its connection URL as an environment variable.
- Passwords come from the environment with a default, and an .env.example is generated next to the compose file.
- Several apps in one repository: a Dockerfile per service folder and a single compose file, optionally with a database per service.
- A compose override per environment (dev, qa, staging, prod or your own); dev also gets a Dockerfile.dev with the source mounted for live reload.
- Networks (including internal and external ones) and a restart policy you choose.
Sample output
services:
app:
build: .
ports:
- "3000:3000"
environment:
DATABASE_URL: "postgres://app:${DB_PASSWORD:?set DB_PASSWORD in .env}@postgres:5432/app"
REDIS_URL: "redis://:${REDIS_PASSWORD:?set REDIS_PASSWORD in .env}@redis:6379"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
postgres:
image: postgres:17-alpine
environment:
POSTGRES_USER: "app"
POSTGRES_PASSWORD: "${DB_PASSWORD:?set DB_PASSWORD in .env}"
POSTGRES_DB: "app"
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL","pg_isready -U app -d app"]
interval: 5s
timeout: 5s
retries: 10
restart: unless-stopped
redis:
image: redis:7-alpine
command: ["redis-server","--requirepass","${REDIS_PASSWORD:?set REDIS_PASSWORD in .env}"]
environment:
REDISCLI_AUTH: "${REDIS_PASSWORD:?set REDIS_PASSWORD in .env}"
volumes:
- redis-data:/data
healthcheck:
test: ["CMD-SHELL","redis-cli ping | grep -q PONG"]
interval: 5s
timeout: 5s
retries: 10
restart: unless-stopped
volumes:
postgres-data:
redis-data:
How it works
- Pick a stack and the options you need.
- Preview every file, and edit or switch off any block.
- Copy the files or download them as a zip.
Questions
Which databases and services can I add?
Postgres, MySQL, MariaDB, MongoDB, Redis, Memcached, Elasticsearch, RabbitMQ and Mailpit. MySQL and MariaDB cannot be combined because both use port 3306.
Can one compose file run several of my apps?
Yes. Split the project into services, each with its own folder and stack, and the output is one compose file with one Dockerfile per service.
How do I keep dev and production apart?
Add environments. Each one gets a compose override file, and dev also gets a Dockerfile.dev that mounts your source.
Are the passwords safe to commit?
The compose file reads them from the environment and falls back to a development default. Put real values in your own .env file; .env.example only shows the names.