Write a Docker Compose file
Describe your services — image, ports, environment, depends_on — and get a valid docker-compose.yml with correct indentation, instead of hand-writing fiddly YAML.
Open the tool, then paste the sample input below. Everything runs locally in your browser.
The problem
A Compose file is whitespace-sensitive YAML, so a wrong indent or a misplaced ports entry stops the stack from coming up. Building it from a few fields per service produces valid structure with the service wiring and port mappings in the right place.
Sample input
web: image nginx:1.27, port 8080->80, depends_on db
db: image postgres:16, env POSTGRES_PASSWORD=secret
Expected output
services:
web:
image: nginx:1.27
ports:
- "8080:80"
depends_on:
- db
db:
image: postgres:16
environment:
POSTGRES_PASSWORD: secret
Ports are quoted "host:container", depends_on is a list, and environment is a map — the indentation that Compose requires is handled for you.
How to do it
- Add each service with its image.
- Set port mappings as host to container.
- Add environment variables and depends_on.
- Generate the docker-compose.yml.
- Copy it and run docker compose up.
Common mistakes
- Wrong indentation, which makes Compose reject the file.
- Writing a port as a number instead of a quoted "host:container" string.
- Using depends_on as a map instead of a list.
- Putting secrets directly in environment instead of an env file.
- Mixing the obsolete top-level version with the modern services key.
Related tools
Related guides
FAQ
How do I write a docker-compose.yml?
Define each service with an image, then add ports, environment, and depends_on. The helper emits valid Compose YAML with the indentation handled.
How do I map a port in Compose?
Use a quoted "host:container" string under ports, for example "8080:80". Writing a bare number maps a container port without a host port.
How do I express that one service needs another?
Use depends_on as a list of service names. It controls start order; for readiness you still need a healthcheck or retry in the app.
Where should secrets go?
Avoid hard-coding secrets in environment. Reference an env file or Docker secrets, and never commit real credentials.
Is my config uploaded?
No. The Compose file is generated locally in your browser. Nothing is sent to a server.
The Compose file is generated locally in your browser. Nothing is uploaded.
Build Compose and Kubernetes manifests, lint Dockerfiles, validate YAML — plus every other utility.