Docker Compose builder
Assemble a docker-compose.yml visually: image or build context, ports, volumes, environment variables, depends_on, restart policy, healthcheck and networks, with live preview and copy.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Services
Give each service an image or a build context; ports, volumes and environment variables take one entry per line.
Preview
services:
web:
image: "nginx:1.27-alpine"
restart: unless-stopped
ports:
- "8080:80"
depends_on:
- api
networks:
- app
api:
build:
context: "./api"
environment:
- "APP_ENV=production"
- "PORT=3000"
volumes:
- "data:/var/lib/data"
networks:
- app
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:3000/health"]
interval: 30s
retries: 3
networks:
app:
driver: bridge
volumes:
data:
The output follows the Compose Specification: the deprecated top-level version field is gone, named volumes are declared under volumes and every referenced network is collected under networks.
What this tool does
- Spin up a local web + database + cache stack: fill in each service image, port and environment once and get a complete compose file.
- Turn scattered docker run flags into declarative configuration — ports, volumes, environment, depends_on and restart policy live in the file so teammates just run docker compose up.
- Add healthchecks and startup order so the app does not crash while the database is still booting.
- Sketch a compose file when the syntax is fuzzy: the live preview immediately shows a malformed port or volume mapping.
Example
Input
web: image nginx:1.27-alpine, ports 8080:80, network app, depends on db; db: image postgres:16-alpine, environment POSTGRES_PASSWORD=secret, volume pgdata:/var/lib/postgresql/data, network app
Output
services:
web:
image: "nginx:1.27-alpine"
ports:
- "8080:80"
depends_on:
- db
networks:
- app
db:
image: "postgres:16-alpine"
environment:
- "POSTGRES_PASSWORD=secret"
volumes:
- "pgdata:/var/lib/postgresql/data"
networks:
- app
networks:
app:
driver: bridge
volumes:
pgdata:
Ports, volumes and environment entries are double quoted so YAML never reads 8080:80 as a number, and the named volume pgdata is declared under the top-level volumes key automatically.
Frequently asked questions
Why is there no version field in the generated file?
Since the Compose Specification, version is obsolete and docker compose v2 only prints a warning when it sees it. A file needs the top-level services key plus optional networks, volumes and configs — so the generator leaves version out.
Does depends_on guarantee the dependency is ready?
No. depends_on only orders startup: db starts before web, but it does not wait until db accepts connections. Give the dependency a healthcheck, or retry from your own startup script, if web must wait for readiness.
Why do some volume entries need a declaration and others do not?
A bind mount such as ./data:/data maps a host path and needs nothing else. A named volume such as pgdata:/var/lib/postgresql/data must be declared under the top-level volumes key or Compose refuses to start, so the generator adds it for you.
What is the difference between the list and mapping forms of environment?
The list form KEY=value and the mapping form KEY: value are equivalent in Compose, but the mapping form risks YAML reinterpretation of values like yes or 1.0. The list form is safer, which is why the generator always uses it.
Can a typo produce invalid YAML?
No. Service names, ports, volumes, environment entries and healthchecks are validated first, and a bad value reports which kind of problem it is (for example, ports must look like 8080:80). The tool never renders YAML that fails to parse.
Keywords:docker composedocker-compose.ymlcompose generatordocker-compose 生成compose filedepends_onhealthcheckdocker networkdocker volume容器编排多服务yaml 配置