Docker Compose Generator
Define your services, ports, environment variables and volumes, then get a clean docker-compose.yml that builds as you type. Use the presets for common databases and copy or download the result.
How to generate a docker-compose.yml
- Add a service and give it a name, then set an image or pick a backing-service preset.
- Fill in ports, environment variables, volumes and any services it depends on.
- Copy the generated YAML or download it as docker-compose.yml in your project root.
Examples
Web app with a Postgres database
services: web (nginx:alpine, port 8080:80, depends on db) + db (postgres preset)
services:
web:
image: nginx:alpine
ports:
- "8080:80"
depends_on:
- db
restart: unless-stopped
db:
image: postgres:16
ports:
- "5432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: app
volumes:
- pgdata:/var/lib/postgresql/data
restart: unless-stopped
volumes:
pgdata: {}Frequently asked questions
Is my configuration sent to a server?
No. The file is generated entirely in your browser from the services you define, so nothing you type is uploaded anywhere.
Why is there no version key at the top of the file?
The modern Compose specification no longer needs a top-level version key, and recent Docker Compose ignores it. The generator omits it by default to match the current spec.
What do the database presets give me?
Each preset fills in a sensible image, the default published port, starter environment variables and a named volume for data. Postgres, MySQL, Redis, MongoDB and Nginx are included, and you can edit any field afterwards.
How do I make one service wait for another?
Add the other service name to the depends on field. Compose then starts the dependency first. Note that depends on waits for the container to start, not for the service inside it to be fully ready.
What is the difference between a named volume and a bind mount?
A mount like pgdata:/var/lib uses a named volume that Docker manages, and the generator declares it under a top-level volumes block. A mount that starts with ./ or / is a bind mount to a host path and is left as is.
Will the output always be valid YAML?
Yes. The file is serialized from a structured object with a YAML library, so indentation and quoting are handled for you and the result parses cleanly.
Related tools
Gitignore Generator
Build a .gitignore from Node, Python, Java, Go, Rust, macOS, Windows and more. Pick your stacks, copy or download the file. Runs in your browser.
YAML Formatter
Format and validate YAML online. Fix indentation, normalize messy YAML, sort keys and catch syntax errors. Runs entirely in your browser.
JSON Formatter
Format, validate and minify JSON online. Pretty-print with custom indentation, sort keys and catch syntax errors. Runs in your browser.
.env to JSON
Convert a .env file to JSON, or JSON back to .env. Parses KEY=value lines, comments, quotes and export. Runs entirely in your browser.
Aspect Ratio Calculator
Calculate aspect ratios fast. Enter a ratio like 16:9 and one dimension to get the other, or enter width and height to simplify the ratio.
Base58 Encoder
Encode and decode Base58 online with the Bitcoin alphabet. Convert text to Base58 or back, UTF-8 safe, no confusing 0 O I l. Runs in your browser.