Free tool

Docker Compose Generator

Build your local stack by adding services visually: databases, cache, proxy and your app. The YAML is generated instantly.

services:

  app:
    image: miapp:latest
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=production
      - DATABASE_URL=postgres://app:cambiar@db:5432/app
    restart: unless-stopped

  db:
    image: postgres:16-alpine
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_USER=app
      - POSTGRES_PASSWORD=cambiar
      - POSTGRES_DB=app
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: unless-stopped

volumes:
  pgdata:

Built by

Miguel Ángel Colorado Marin (MACM)

Full-Stack Developer · Guadalajara, España

I develop web apps, digital tools and full projects — from design to deployment.

Contact me

The docker-compose.yml file defines every container in a local project — database, cache, backend — and how they connect to each other. Writing it by hand usually means digging through each image's docs for the required environment variables, exposed ports and data paths. This generator ships the most common services already configured with their correct values: pick a preset, tweak what you need (name, ports, vars, restart policy) and declare dependencies between containers to control startup order. Named volumes are declared on their own in the final YAML's volumes section.

Features

  • PostgreSQL, MySQL, MariaDB, Redis, MongoDB and Nginx presets
  • Ports, volumes and env vars per service
  • depends_on by selecting services
  • Named volumes declared automatically
  • Ready-to-copy YAML

How to generate a docker-compose.yml?

  1. 1

    Add your services

    Start with a database or cache preset and add what you need.

  2. 2

    Tune each service

    Name, image, ports, volumes, env vars and restart policy.

  3. 3

    Declare dependencies

    Check depends_on so the database starts before your app.

  4. 4

    Save and run

    Copy the content into docker-compose.yml and run "docker compose up -d".

Frequently asked questions

Do I need the version: key in my compose file?

No. The current Compose specification has deprecated version: for years; modern files start directly with services:. If you run a very old version you'll get a warning anyway.

How do the containers talk to each other?

Compose creates a shared network where each service resolves by name: if your database is named db, your app can use host db with the internal port (5432), even without publishing that port externally.

Is everything generated in my browser?

Yes, the YAML is composed locally. No configuration is uploaded.

Related tools

Embed Docker Compose Generator on your site

Add Docker Compose Generator to any web page with a simple iframe. Free, with attribution to miguelacm.es.

<iframe
  src="https://miguelacm.es/embed/docker-compose-generator"
  width="100%"
  height="700"
  frameborder="0"
  title="Docker Compose Generator — miguelacm.es"
></iframe>
View embed in new tab →