Generate docker-compose.yml files for multi-service applications with services, volumes, networks, and environment variables.
services:
app:
image: myapp:latest
ports:
- "3000:3000"
environment:
- NODE_ENV=production
networks:
- app-network
restart: unless-stopped
database:
image: postgres:16
ports:
- "5432:5432"
environment:
- POSTGRES_PASSWORD=secret
volumes:
- db-data:/var/lib/postgresql/data
depends_on:
- app
networks:
- app-network
restart: unless-stopped
networks:
app-network:
driver: bridge
volumes:
db-data:Docker Compose defines multi-container applications as a single YAML file. Each service specifies an image or build context, exposed ports, environment variables, volume mounts, and network membership. Compose handles starting all services in the correct order with a single <code>docker compose up</code> command.
Add one row per service. Set the image name, ports (host:container format), environment variables, and volume mounts. Named volumes (no leading /) are automatically declared in the top-level volumes section. Bind mounts (starting with / or ./) are passed through as-is.
This generator targets Compose V2 (the default since Docker Desktop 3.x and Docker Engine 23.x). The deprecated <code>version:</code> top-level key is intentionally omitted. Service dependencies can be expressed with <code>depends_on</code> - add it to the ports field as a YAML key for now, or edit the output directly.