⚡
usefultools.dev
🐳

Docker Compose Generator – docker-compose.yml Builder

NEW

Docker Compose generator: add Node, Postgres, MySQL, Redis, Mongo or Nginx services with ports, env, volumes and healthchecks, and get valid YAML.

Runs 100% in your browser — your input is never uploaded or stored on our servers.

Service 1: app

Depends on

Service 2: db

Depends on

  • warning: Service "db": POSTGRES_PASSWORD is a placeholder. Use a real secret, ideally via an .env file or Docker secrets.

Generated Docker Compose filedocker-compose.yml

# docker-compose.yml generated by UsefulTools.dev
# Start: docker compose up -d   Validate: docker compose config
services:
  app:
    build: "."
    restart: "unless-stopped"
    ports:
      - "3000:3000"
    environment:
      NODE_ENV: "production"
      PORT: "3000"
    depends_on:
      db:
        condition: "service_healthy"
  db:
    image: "postgres:17"
    restart: "unless-stopped"
    ports:
      - "5432:5432"
    environment:
      POSTGRES_USER: "app"
      POSTGRES_PASSWORD: "change-me"
      POSTGRES_DB: "app"
    volumes:
      - "pgdata:/var/lib/postgresql/data"
    healthcheck:
      test:
        - "CMD-SHELL"
        - "pg_isready -U app -d app"
      interval: "10s"
      timeout: "5s"
      retries: 5
volumes:
  pgdata:
⚡

Quick Examples

Typical inputs and the results this tool produces.

depends_on
app depends on Postgres
condition: "service_healthy"
Volume
pgdata:/var/lib/postgresql/data
volumes: pgdata:
Check
8080:80 on two services
Port conflict: host port 8080/tcp
Check
Port 80:70000
Error: port is not valid
📖

Overview

Docker Compose describes a multi-container app in one YAML file: which images to run, their ports, environment variables, volumes, dependencies and restart policies. This Docker Compose generator builds that file from service cards, with presets for a Node app, PostgreSQL, MySQL, Redis, MongoDB, Nginx and any custom image.

Named volumes and networks are declared automatically, depends_on switches to service_healthy when the dependency has a healthcheck, and the output is serialised with js-yaml so it is always valid YAML. Host port conflicts, invalid ports, dependency cycles and placeholder passwords are flagged as you type. Everything stays in your browser.

The file updates live as you edit and covers the common service keys: image, build, command, ports, environment, volumes, networks, restart, depends_on and healthcheck. Other Compose options, such as profiles, secrets, deploy or resource limits, are not generated, so add them by hand if you need them.

Why use this tool?

  • Database presets with working healthchecks
  • Port conflicts caught before docker compose up
  • Named volumes declared for you
  • Always-valid YAML, no indentation mistakes
  • Runs locally, your passwords stay private
⭐

Features

📦

Service presets

Node, Postgres, MySQL, Redis, Mongo, Nginx and custom image with sensible defaults.

🩺

Healthchecks

CMD-SHELL test with interval, timeout and retries; dependants wait for service_healthy.

💽

Volumes and networks

Named volumes and networks are detected and declared at the top level.

⚠️

Validation

Duplicate names, port conflicts, invalid ports, durations and depends_on cycles.

📝

Valid YAML

Generated with js-yaml and quoted values, with a short comment header.

💾

Download

Save as docker-compose.yml or copy to the clipboard.

🛠️

How to Use

1

Add services

Choose a preset in "Add a service" and press + Add.

2

Edit each card

Set image or build context, ports, environment, volumes and restart policy.

3

Wire dependencies

Tick "Depends on" and enable healthchecks where startup order matters.

4

Download and run

Download the file and run docker compose up -d.

🤔

Frequently Asked Questions