DevOps Generators

Docker Compose Generator

All tools

Name your service and get a two-container compose file for local development.

How it works

Four simple steps

1

Name the service

Type the name for the web container, such as app.

2

Generate the file

Press Run to build the two-service YAML.

3

Edit the defaults

Change the password, images and ports for your project.

4

Save docker-compose.yml

Download it to the project root and run docker compose up.

Docker Compose Generator

About Docker Compose Generator

You have a static site or front-end build and want it served next to a Postgres database on your laptop, without installing either. A compose file with two services does that, and this generator writes the boilerplate.

Type a service name and press Run, or use Sample. The output defines two services. Yours runs nginx:alpine, maps host port 8080 to container port 80, and mounts the whole project folder (including the compose file itself) read-only as the web root. The second, db, runs postgres:16-alpine with POSTGRES_PASSWORD set to change-me and a named volume, db_data, so data survives docker compose down. The file uses the current Compose format with no version key.

The name is the only input; images, ports and the password are fixed, so edit them after copying. Replace change-me (the password generator makes a strong one) and move it into an .env file rather than the YAML. Pin image versions you have tested, and if your app is not static, swap nginx for your own image and add depends_on. Note that docker compose down -v also deletes the db_data volume.

The YAML is written in your browser and downloads as docker-compose.yml. Check your edits with the online YAML checker, and if you build your own image, run it past the Dockerfile best-practice linter.

Keyboard shortcut

Ctrl Enter - Run tool
FAQ

Frequently asked questions

See all FAQs

Answers for this tool. For site-wide help, open the FAQ hub.

Use the service name db as the hostname and port 5432. Containers on the default compose network resolve each other by service name.

The db service has no ports mapping, so 5432 is only reachable inside the compose network. Add a ports entry such as "5432:5432" under db if a tool on your host needs access.

No. Current Docker Compose treats the top-level version field as obsolete and ignores it, so the generator leaves it out.

View more FAQs

Related tools

View all

Kubernetes Manifest Studio

Generate Deployment, Service, and Ingress YAML with a drift checklist.

Open

K8s Inspector

Summarize Kubernetes YAML kinds, names, and labels.

Open

K8s Resource Diff

Diff two Kubernetes manifests locally.

Open

K8s Manifest Splitter

Split multi-document YAML into one file per resource.

Open

Explore 321 free tools

Everything you need as a developer, marketer or creator - in one beautiful place.

Browse all tools