Skip to main content

Docker Compose Builder

Build a docker-compose.yml from ready service templates (PostgreSQL, MySQL, Redis, MongoDB, Nginx and more), or paste a file to check it. Private.

postgres: POSTGRES_PASSWORD is "changeme". Change it before you use this anywhere real.
postgres is published on port 5432, so anything that can reach this machine can try to connect. Remove "ports" if only other containers need it.
redis is published on port 6379, so anything that can reach this machine can try to connect. Remove "ports" if only other containers need it.

Services

docker-compose.yml

services:
postgres:
image: postgres:16-alpine
container_name: postgres
restart: unless-stopped
environment:
POSTGRES_USER: app
POSTGRES_PASSWORD: changeme
POSTGRES_DB: app
ports:
- 5432:5432
volumes:
- postgres_data:/var/lib/postgresql/data
redis:
image: redis:7-alpine
container_name: redis
restart: unless-stopped
ports:
- 6379:6379
volumes:
- redis_data:/data
volumes:
postgres_data:
redis_data:

Shortcuts: Ctrl+Enter run · Ctrl+Shift+C copy result · / search (use ⌘ on Mac)

Next steps

Done here? Use the Send to… menu on the result to carry it on to YAML ↔ JSON Converter or Kubernetes YAML Validator.

Free Online Docker Compose Generator and Validator

Pick the services you need, such as a database and a cache, and get a working docker-compose.yml. Or paste an existing file and see what is wrong with it. It gives developers a quick browser-based way to solve a focused docker compose builder task before moving the result into a project.

How to build a compose file

Tick the services, change the host ports if they clash with something on your computer, and copy or download the file. Save it as docker-compose.yml and run docker compose up.

How to check a file

Choose Check a file, paste your file and press Check. Each finding names the service and setting.

Common mistakes

  • Publishing a database port on every network interface: bind it to 127.0.0.1 if only your machine needs it.
  • Leaving the sample passwords in place when the file goes to a server.

Frequently asked questions

Which Compose version does it write?
The current Compose Specification: there is no "version:" line, which Docker Compose v2 ignores anyway.
What does the check look for?
Missing image or build, ports in the wrong format, two services on the same host port, depends_on names that do not exist, undeclared named volumes and networks, unusual restart values and untagged images.
Why are passwords set to "changeme"?
Templates need a value to start. Change them, and keep real secrets in a .env file that is not committed, then reference them as ${VARIABLE}.
Is my file uploaded?
No. Building and checking happen in your browser.
How do I use this docker compose builder tool?
Use the interactive controls above; processing stays in your browser and the result is intended as a practical starting point for development work.

More DevOps & Network

View all DevOps & Network tools →