How to use the Docker Compose generator
- Keep Web app (built from ./Dockerfile) ticked and set the Web app port, or untick it to run only the backing services.
- Choose the Database: PostgreSQL, MySQL, MariaDB, MongoDB or None, and set the Database name.
- Tick Redis, nginx reverse proxy on port 80 and Adminer database UI (localhost only) as needed.
- Save the first file as
compose.yamland the second as.envin the same folder. Fill in every empty password in.env. - Run
docker compose up -d.
What it does and when to use it
Docker Compose starts several containers together from one file, the usual way to run an app with its database on a laptop or a small server. This tool follows current advice: no version key, health checks, and no passwords in the file. The Compose file reference documents every key.
Use it when you containerise a project or replace an old file. The web service builds from a Dockerfile in the same folder, which you can make with the Dockerfile generator. With the nginx option, write the server block with the nginx config generator and point it at http://web:3000. To list the app’s other variables safely, use the .env example generator.
How it works
- Database: an official image (postgres:18, mysql:9.7, mariadb:12.3 or mongo:8.0), a named volume for data, and a health check such as
pg_isreadyormysqladmin ping. - Redis: redis:8 with a data volume and a
redis-cli pinghealth check. - Web:
build: .,env_file: .env, connection URLs, anddepends_onwithcondition: service_healthy, so the app starts only after the database answers. - nginx: nginx:1.30-alpine on port 80 with
./nginx/default.confmounted read-only. The web port is then exposed only inside the network.
Image tags were checked on 2026-10-02.
Worked examples
Default stack: app, PostgreSQL and Redis.
db:
image: postgres:18
restart: unless-stopped
environment:
POSTGRES_DB: app
POSTGRES_USER: ${POSTGRES_USER:-app}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}
The volume is mounted at /var/lib/postgresql, the layout PostgreSQL 18 images use. The .env holds POSTGRES_USER=app and an empty POSTGRES_PASSWORD=.
MySQL shop behind nginx. Database MySQL named shop, Redis off, nginx on. The app gets DATABASE_URL: mysql://${DB_USER:-app}:${DB_PASSWORD}@db:3306/shop, and .env asks for DB_PASSWORD and DB_ROOT_PASSWORD.
Nothing ticked. With no web app, no database and no Redis, the tool returns “Choose at least one service.”
Limits and tips
- Never commit .env. Add it to .gitignore before the first commit.
- Special characters in passwords such as
@or/break the connection URL; URL-encode them or avoid them. - The web container receives all of .env through
env_file, including the database root password. Split the file if that matters. - For production, add backups for the database volume.
Frequently asked questions
Why does docker compose up stop with "set POSTGRES_PASSWORD in .env"?
Why is there no version line at the top?
How does my app reach the database?
Is the database open to the internet?
Should I call the file docker-compose.yml or compose.yaml?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.