docker-compose.yml Builder

Generate a docker-compose file with services, volumes, and networks

Add services such as web, api, db, and cache with their images, ports, environment variables, volumes, and dependencies, and get a valid docker-compose.yml with named volumes and a shared bridge network. Runs entirely in your browser.

What does depends_on actually guarantee?

By default depends_on only controls start order — Compose starts the dependency container first, but does not wait for the service inside it to be ready. For true readiness, add a healthcheck to the dependency and use depends_on with condition: service_healthy.

A docker-compose.yml builder that turns a list of services — each with an image, ports, environment variables, volumes, and dependencies — into a valid Compose file complete with a top-level volumes block and a shared bridge network. It is built for developers spinning up a multi-container stack without hand-writing YAML and worrying about indentation.

How it works

Each service you add becomes one entry under the top-level services: key. The builder emits the image, a sensible restart: unless-stopped, a quoted list of ports, an environment map, a volumes list, and a depends_on list. Every service is attached to a single declared appnet bridge network so containers can resolve one another by service name.

Volume mounts are inspected: a source like db-data:/var/lib/postgresql/data is recognised as a named volume and collected into the top-level volumes: block, while a source like ./src:/app is treated as a bind mount and left inline. This keeps the generated file valid — named volumes must be declared, bind mounts must not.

Tips and notes

  • depends_on only orders startup. For databases, add a healthcheck to the db service and depend on it with condition: service_healthy so your app does not connect before Postgres is accepting queries.
  • Inside the network, use the service name as the hostname. An api connecting to a db service should use db:5432, not localhost.
  • Keep secrets out of the committed file — point sensitive services at an env_file or use shell-substituted variables like POSTGRES_PASSWORD=${DB_PASSWORD}.
  • Run docker compose config after pasting the file to have Docker validate and normalise it before you bring the stack up.