Docker Compose Generator
Build a complete docker-compose.yml file with a visual form and live YAML validation.
Client-side only — nothing leaves your browser
Services
Lowercase letters, digits, _ and -
e.g. nginx:alpine, postgres:16
Optional. Leave blank for default
HOST:CONTAINER. Add /tcp or /udp for protocol. Example: 53:53/udp
Bind mount (starts with ./ / ~) or reference a named volume defined below.
None.
Comma-separate multiple paths
Service names this one needs started first.
Names defined under the top-level networks: block.
Override the container's default command (optional)
Lowercase letters, digits, _ and -
e.g. nginx:alpine, postgres:16
Optional. Leave blank for default
HOST:CONTAINER. Add /tcp or /udp for protocol. Example: 53:53/udp
Bind mount (starts with ./ / ~) or reference a named volume defined below.
Comma-separate multiple paths
None.
Service names this one needs started first.
Names defined under the top-level networks: block.
Override the container's default command (optional)
Named volumes
Named networks
services:
web:
image: nginx:alpine
restart: unless-stopped
ports:
- "8080:80"
volumes:
- ./html:/usr/share/nginx/html:ro
depends_on:
- db
networks:
- appnet
db:
image: postgres:16
restart: unless-stopped
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
environment:
POSTGRES_USER: app
POSTGRES_PASSWORD: changeme
POSTGRES_DB: appdb
networks:
- appnet
volumes:
pgdata:
networks:
appnet:
driver: bridge
No issues detected
Your compose file passes structural checks. Validate further with docker compose config.
Run it
- 1. Save as
docker-compose.yml - 2.
docker compose config(validate) - 3.
docker compose up -d(start) - 4.
docker compose ps(check status)
What is a docker-compose.yml File?
A docker-compose.yml file is a YAML configuration that describes a multi-container Docker application — every service (container), the named volumes that persist data between runs, the networks that connect containers, and the relationships between them. Instead of stringing together a dozen docker run flags, you declare the whole stack in one file and bring it up with docker compose up -d. This generator produces a Compose Specification file that works with both the v1 plugin (docker-compose) and the modern v2 CLI (docker compose).
Anatomy of a Compose Service
Every entry under the top-level services: key is a single container definition. These are the keys this generator emits:
| Key | Purpose |
|---|---|
| image | Image tag to pull (e.g. postgres:16). Mutually exclusive with build: |
| container_name | Fixed name instead of <project>_<service>_1. Breaks scaling — use sparingly |
| ports | Publish container ports to the host. Format HOST:CONTAINER or HOST:CONTAINER/proto |
| volumes | Bind mounts (host paths) or named volumes for persistence |
| environment | Inline env vars passed to the container as KEY=value |
| env_file | Load env vars from one or more files. Paths are relative to the compose file |
| depends_on | Start ordering. Does NOT wait for the dependency to be ready — only running |
| restart | no, always, on-failure, or unless-stopped |
| networks | Which user-defined networks this service joins |
| command | Override the image's default CMD |
Docker Compose Restart Policies
The restart: key controls when the Docker daemon brings a container back up after it stops.
| Policy | Restarts when |
|---|---|
| no | Default. Never restart automatically. Must be quoted in YAML or it becomes boolean false. |
| always | Always restart, including after a host reboot — even if you stopped the container manually. |
| on-failure | Restart only on non-zero exit. Can be limited: on-failure:5 tries five times. |
| unless-stopped | Like always, but respects a manual docker stop. The most common choice for long-running services. |
Common docker-compose Stacks
Patterns for the most-searched Compose stacks. Use them as a starting point — paste a service into the form above and tweak.
nginx (reverse proxy / static site)
services:
web:
image: nginx:alpine
ports:
- "80:80"
volumes:
- ./html:/usr/share/nginx/html:ro
- ./nginx.conf:/etc/nginx/nginx.conf:ro
restart: unless-stoppedPostgreSQL with persistent volume
services:
db:
image: postgres:16
ports:
- "5432:5432"
environment:
POSTGRES_USER: app
POSTGRES_PASSWORD: changeme
POSTGRES_DB: appdb
volumes:
- pgdata:/var/lib/postgresql/data
restart: unless-stopped
volumes:
pgdata:Nextcloud + MariaDB + Redis
services:
app:
image: nextcloud:apache
ports:
- "8080:80"
environment:
MYSQL_HOST: db
MYSQL_DATABASE: nextcloud
MYSQL_USER: nextcloud
MYSQL_PASSWORD: changeme
REDIS_HOST: cache
volumes:
- nc_data:/var/www/html
depends_on:
- db
- cache
restart: unless-stopped
db:
image: mariadb:11
environment:
MYSQL_ROOT_PASSWORD: changemeroot
MYSQL_DATABASE: nextcloud
MYSQL_USER: nextcloud
MYSQL_PASSWORD: changeme
volumes:
- db_data:/var/lib/mysql
restart: unless-stopped
cache:
image: redis:alpine
restart: unless-stopped
volumes:
nc_data:
db_data:Frequently Asked Questions
What is a docker-compose.yml file?
Is the file docker-compose.yml or docker-compose.yaml?
What is the difference between a Dockerfile and a docker-compose.yml?
What does depends_on do in docker-compose?
What restart policy should I use in docker-compose?
Related Tools
Dockerfile Generator
Build Dockerfiles from form inputs. Multi-stage builds, healthchecks, and best-practice hints inline.
Firewall Rule Generator
Cross-platform firewall rule builder (UFW, iptables, nftables, Windows, AWS, GCP). Also explains existing rules.
iptables to nftables
Convert iptables rules to nftables. Translates chains, NAT, conntrack, and common matchers.
Nginx Config Generator
Generate nginx.conf from form inputs. Reverse proxy, SSL, static files, load balancer, and basic auth — all common modes.
Nginx to Caddy Converter
Convert nginx server blocks to Caddyfile syntax. Maps reverse_proxy, TLS, redirects, and headers.
Need to manage SSH connections?
SSH Workbench lets you connect, browse files, and manage servers visually.
Try SSH Workbench Free