Docker Compose in production: the honest checklist
⏱️ 2 min read
Compose is not the problem
A well-configured docker-compose.yml runs small production workloads fine. What fails is the default config: no restart policy, unbounded logs, no probes. Run this checklist and Compose stops being your weak link.
The nine checks
- restart: unless-stopped on every service. Without it, a host reboot leaves you dark.
- Log caps:
logging: driver: json-file options: {max-size: "10m", max-file: "3"}Unbounded json-files are the #1 disk-full cause we see. - Healthchecks: real healthchecks plus
depends_on: condition: service_healthy, so the app does not boot before the DB accepts connections. - Memory limits per service (
mem_limit) — the OOM killer otherwise shoots the whole host. - Pinned image tags, never
latest. Reproducibility beats convenience. - Secrets out of the file:
env_filegitignored, or Docker secrets. - Pull policy:
pull_policy: alwayson deploy nodes so rollback-by-tag actually works. - Networks: internal network for DB traffic; only the proxy publishes ports.
- A real reverse proxy (Caddy/Nginx) with auto-TLS in front, not raw app ports.
When to graduate
Compose stops being honest past one host, or when you need rolling deploys. Then move to Swarm-mode Compose files or Kubernetes — same YAML instincts, better control plane. Lab both cheaply on hourly cloud boxes: Vultr or DigitalOcean. (Partner links.)