Config generators
Docker Compose generator
Write a clean compose.yaml for a self-hosted app: image, ports, volumes, environment, restart policy and an external network for your reverse proxy — with YAML quoting that avoids the classic port and boolean pitfalls.
compose.yaml
services:
web:
image: nginx:1.27-alpine
container_name: web
restart: unless-stopped
ports:
- "8080:80"
volumes:
- ./html:/usr/share/nginx/html:ro
environment:
TZ: "Etc/UTC"
Start it with docker compose up -d in the folder that holds the file.
How to use it
- Enter the image with a pinned version tag (e.g. nginx:1.27-alpine) rather than latest, so updates happen when you choose.
- List ports as host:container. Bind to 127.0.0.1 (127.0.0.1:8080:80) when only a reverse proxy on the same host should reach the app.
- List volumes as host-path:container-path; add :ro for read-only mounts.
- Copy or download the file and run docker compose up -d. Keep passwords in an .env file, not in a shared link.
Formula and method
services:
<service>:
image: <image:tag>
restart: unless-stopped
ports:
- "host:container" # always quoted
volumes:
- host-path:container-path(:ro)
environment:
KEY: "value"- Ports are always quoted: YAML 1.1 parsers read unquoted values like 22:22 as base-60 numbers.
- Values YAML could read as booleans or numbers (yes, on, 0755) are quoted too; restart "no" must be quoted for the same reason.
- The file uses the current Compose Specification (no top-level version: key).
Worked example
services:
web:
image: nginx:1.27-alpine
container_name: web
restart: unless-stopped
ports:
- "8080:80"
volumes:
- ./html:/usr/share/nginx/html:ro
environment:
TZ: "Etc/UTC"FAQ
Do I still need "version:" at the top?
No. Docker Compose v2 follows the Compose Specification, which ignores the top-level version key and warns that it is obsolete.
Is it safe to put passwords in environment?
They end up in the file and in docker inspect output. Prefer an .env file next to compose.yaml (not committed to git) or Docker secrets, and never share a link containing them.
unless-stopped or always?
Both restart after crashes and reboots; unless-stopped keeps a container down after you stopped it on purpose, which is usually what you want in a homelab.
Related tools
- Nginx & Caddy reverse proxy config generator — Generate an Nginx or Caddy reverse-proxy config with HTTPS, WebSockets, HSTS and upload limits for a self-hosted app.
- Cron expression builder & explainer — Check a cron expression, read it in plain English and see its next run times in your timezone.
Formulas reviewed November 27, 2026 by Novian · runs entirely in your browser · methodology