Docker Compose Generator
About the Docker Compose Generator
This Docker Compose generator builds a ready-to-run docker-compose.yml from service presets such as Node.js, PostgreSQL, MySQL, Redis and Nginx. Edit ports, environment variables, volumes and dependencies in a form, and the YAML is validated and updated as you go.
What is Docker Compose?
Docker Compose runs a multi-container application from one YAML file. Instead of typing a long docker run command for each container, you describe every service, its image, ports, environment and storage, then start everything with docker compose up -d and stop it with docker compose down.
Services in the same Compose project share a default network and can reach each other by service name. An app container connects to the database at host postgres, port 5432, not localhost.
Ports, volumes and depends_on explained
Ports are written HOST:CONTAINER. 8080:80 makes the container's port 80 reachable at localhost:8080 on your machine. You can also bind to one interface (127.0.0.1:5432:5432), map a range, or add /udp.
A volume entry like postgres_data:/var/lib/postgresql/data uses a named volume managed by Docker, so data survives docker compose down. An entry that starts with ./ or /, like ./:/app, is a bind mount of a folder on your machine. Named volumes are declared automatically in the top-level volumes: section.
depends_on only controls start order. It does not wait for the database to be ready to accept connections, so your app should retry its first connection or you should add a healthcheck.
Why there is no version: line
Older files started with version: "3.8". The current Compose Specification, used by Docker Compose v2, ignores that key and prints a warning that it is obsolete, so the generator leaves it out.
How to Use the Docker Compose Generator
- Under Add a service, click a preset such as Node.js, PostgreSQL, Redis or Custom. The page starts with a Node.js app and PostgreSQL.
- For each service, set the Service name, Image, Restart policy, and optionally the Command and Working dir.
- Enter Ports (host:container), Environment (KEY=value) and Volumes (src:target), one per line.
- Tick the services under Depends on to control start order.
- Fix anything listed under Fix before using, then click Copy or Download to save docker-compose.yml.
Frequently Asked Questions
- Is my configuration sent to a server?
- No. The YAML is generated in your browser. Service names, passwords and paths you type never leave your device.
- Why does my app get "connection refused" to the database?
- Inside Compose, connect using the service name as the host (for example postgres), not localhost. Also note that depends_on does not wait for the database to finish starting.
- Should I keep passwords in docker-compose.yml?
- Not for anything shared or deployed. Move them to a .env file next to the Compose file and reference them as ${POSTGRES_PASSWORD}. The .env File Generator can create that file.
- Is this compatible with docker-compose v1?
- The output follows the Compose Specification used by docker compose (v2). Most of it also works with the legacy docker-compose v1 binary, which reached end of life in 2023.
- How do I add a healthcheck or networks?
- The form covers the most common keys. Add healthcheck:, networks: or build: by editing the downloaded YAML.
- What does the :ro suffix on a volume mean?
- It mounts the volume read-only inside the container, as in the Nginx preset's ./nginx.conf:/etc/nginx/conf.d/default.conf:ro.