Docker Compose Generator
Build a docker-compose.yml from service presets with ports, volumes, env and dependencies.
Add a service
e.g. postgres:17-alpine — leave empty when building
Folder with a Dockerfile, e.g. .
Ports (host:container)
Volumes
Environment
| Variable | Value | ||
|---|---|---|---|
Starts after
services:
app:
build: .
restart: unless-stopped
ports:
- "3000:3000"
environment:
NODE_ENV: "production"
DATABASE_URL: "postgres://app:change-me@db:5432/app"
REDIS_URL: "redis://redis:6379"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
db:
image: "postgres:17-alpine"
restart: unless-stopped
ports:
- "5432:5432"
environment:
POSTGRES_USER: "app"
POSTGRES_PASSWORD: "change-me"
POSTGRES_DB: "app"
volumes:
- "pgdata:/var/lib/postgresql/data"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U app"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: "redis:7-alpine"
command: "redis-server --appendonly yes"
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- "redisdata:/data"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
volumes:
pgdata:
redisdata:
Replace the “change-me” passwords, ideally with values from an .env file (Compose reads ${VAR} from it automatically).