Skip to content

Docker Compose Generator

Build a valid docker-compose.yml from a form. Add services, ports, env vars, volumes, depends_on, and restart policies, then copy or download.

Stop fighting YAML indentation

One stray space and docker compose up throws yaml: line 14: did not find expected key. Been there. Compose files look simple until you’re four services deep and a port mapping silently lands under the wrong key.

This builder skips that whole class of bug. You fill in a short form per service: name, image, the ports you want exposed, environment variables as plain KEY=value lines, volumes, what it depends on, and a restart policy. The right-hand pane renders a valid docker-compose.yml live as you type. Two-space indentation, list dashes lined up, the works.

How it builds the file

Each service becomes a block under services:. Ports, environment, volumes, and depends_on are written as YAML lists, one dash per item. Type a port like 8080:80 and it shows up as - "8080:80" (quoted, because Compose treats 5432:5432 as a sexagesimal number otherwise, a real foot-gun the generator handles for you).

Environment variables get quoted only when they need it. A clean NODE_ENV=production stays bare; a value with a colon, a #, or a leading space gets wrapped so the parser doesn’t choke. Same logic for image tags and volume paths.

Here’s a nice touch: if a volume source has no leading . or / (say pgdata:/var/lib/postgresql/data), it’s a named volume. The tool spots those and adds the top-level volumes: block at the bottom for you. Bind mounts like ./data:/app are left alone.

A few things worth knowing

By default there’s no version: key. Modern Compose (v2, the docker compose plugin) ignores it and prints a deprecation warning if you include it. If you’re stuck on an older standalone docker-compose binary, flip the checkbox to emit version: '3.8'.

  • depends_on accepts comma-separated or line-separated names, so db, redis and two separate lines both work.
  • Leave a field blank and it’s simply omitted. An empty service is dropped from the output entirely.
  • The restart dropdown covers the four real options: no, always, unless-stopped, on-failure. Pick (none) to skip the key.

Nothing gets uploaded. The YAML is assembled in your browser with a hand-written serializer, so configs with database passwords or API keys never touch a server. Paste secrets without thinking twice.

Common questions

Does it use the compose spec or the old format?

It targets the current Compose specification, the same one docker compose reads today. The version field is optional and off by default because Compose v2 doesn’t need it.

Why are my ports wrapped in quotes?

On purpose. YAML reads 22:22 as a base-60 number, which mangles your mapping. Quoting forces it to stay a string. It’s the safe default and what Docker’s own docs recommend.

Can I add more than three services?

Yep, as many as you want. Hit + Add Service for each one. The sample stack loads a three-tier web/api/db setup so you’ve got a working starting point.

What about networks, healthchecks, or build contexts?

Not yet. This covers the fields most compose files actually use day to day. For a healthcheck or custom network, generate the base file here and add those blocks by hand in your editor.

Is the output ready to run?

As long as your images and ports are real, yes. Download it as docker-compose.yml, drop it in your project root, and run docker compose up -d. No reformatting needed.

docker compose yaml devops containers

Related Tools

More in Developer Tools