In this guide: Docker Compose: basic example. A minimal compose for an app.
Commands below target a typical Linux setup (Ubuntu/Debian). On other distros, package/service names may differ.
If something goes wrong: check the service is running, listening on the expected port, and that your firewall allows the connection. For web services, `nginx -t` and `journalctl -u nginx` are good starting points. Do not store secrets in git. Use an uncommitted `.env` or a secret manager.
After completing the steps below, verify the result: service status, logs, and network reachability. This saves hours when an issue shows up later.
Below you’ll find a quick checklist, verification commands, and common pitfalls. This helps you not only “do it”, but also confirm what a correct outcome looks like.
Quick checklist
- Do not store secrets in git. Use `.env` or a secrets manager.
- Watch disk usage: Docker can quickly grow `/var/lib/docker`.
- Check container logs, not just status.
- Make one small change at a time and verify the result immediately.
- Keep notes of what you changed (file/command/time).
Verify the result
# Verify / sanity checks
docker version || true
docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' || true
docker compose ps 2>/dev/null || true
docker system df || trueCommon pitfalls
- Secrets committed into compose/git.
- Disk growth from images/logs without cleanup.
services:
app:
image: ghcr.io/example/app:latest
restart: unless-stopped
ports:
- "3000:3000"Need a VPS now?
Rent a WHITEWHALE VDS and launch in minutes.
European locations, transparent pricing, quick self-serve ordering.
