About the Docker Compose Generator
You use this tool to make a starter docker-compose.yml and a matching .env file in your browser. Developers who need a quick local stack use it for apps, databases and Redis caches. The page runs client-side, so nothing uploads to a server after the page loads. It updates results as you type; there is no calculate button. The generator writes files in the current Compose Specification format and omits a top-level version line. Databases store data in a named volume and include a healthcheck. The app service waits for healthy services with depends_on condition: service_healthy. The database and Redis are reachable from the app by service name but are not exposed to your computer. You can copy, download, or share a link that reopens with your inputs.
How to use it
- 1Choose an app name and app type (Node.js, Python, PHP, static, or services only).
- 2Pick run mode: build from My Dockerfile or use the official image with your code mounted, then set the host port.
- 3Select a database and cache if needed and review the generated .env values.
- 4Copy or download docker-compose.yml and .env, add .env to .gitignore, then start with docker compose up.
Worked example
Inputs: App service name: web App: Node.js Run the app from: The official image with my code mounted Port on your computer: 3000 Database: PostgreSQL 17 Cache: Redis 7 Resulting docker-compose.yml (exact snippet): services: web: image: node:18 volumes: - ./:/usr/src/app ports: - "3000:3000" depends_on: db: condition: service_healthy cache: condition: service_healthy env_file: - .env restart: unless-stopped db: image: postgres:17 environment: - POSTGRES_USER=${POSTGRES_USER} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} volumes: - db-data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL","pg_isready -U ${POSTGRES_USER}"] interval: 10s timeout: 5s retries: 5 cache: image: redis:7 healthcheck: test: ["CMD","redis-cli","ping"] interval: 10s timeout: 5s retries: 5 volumes: db-data: Resulting .env (exact snippet): POSTGRES_USER=postgres POSTGRES_PASSWORD=change_me # Change these passwords before using on a public server and add .env to .gitignore.
How it works
Builds a Compose file in the current Compose Specification format (no version line, which Docker now ignores)The database keeps its data in a named volume, has a health check, and the app waits for it with depends_on: condition: service_healthyThe app reaches the services by their names (db, cache), so database and Redis ports are not opened to your computerPasswords come from a .env file next to the Compose fileSource: Compose SpecificationDocker Compose file reference. Last checked 6 November 2026.
What it is good for
- Generates a ready-to-run docker-compose.yml and .env in seconds.
- Stores database data in a named volume and adds a healthcheck automatically.
- Runs fully in your browser after load; nothing is uploaded while you edit.
- Does not expose secrets to production; change .env passwords before deploying.
- No advanced per-service network or secret-manager configuration in the form.
Questions people ask
Does this generator send my data to a server?
No. The page runs client-side in your browser after it loads. Nothing is uploaded while you type, but confirm with your network tools if you need absolute assurance.
Which Compose file version does it produce?
It produces files in the current Compose Specification format and omits a top-level version line. Docker now ignores that version line. See the Compose Specification on GitHub for details.
Will depends_on guarantee my database is ready?
The generator adds a healthcheck for the database and uses depends_on with condition: service_healthy. This tells Compose to wait for the healthcheck. Also add app-level retry logic for production readiness.
Are database ports open to my computer?
No. The database and Redis are reachable from your app by the service names db and cache. Their ports are not published to your host in the generated template.
What should I do with the .env file?
Edit the .env file to change default passwords before you use this on a server. Add .env to .gitignore so you do not commit secrets to Git.
Are image versions fixed or updated?
Generated images use current long-term releases at the time of generation. Check Docker Hub for newer versions and update the image tags before deploying to production.
Help keep every tool free
FreeToolr stays free because people help it grow. Share a tool you like, tell us what to build next, or support us on Ko-fi.