Compose is enough longer than you think
Docker Compose runs a multi-container app from one YAML file; climb to Swarm or Kubernetes only on named triggers.
Published here , updated · 7 sources · Resume reading
Docker Compose defines a multi-container app in YAML and starts it with one CLI workflow [1]. Many products stay healthy on Compose long after someone suggested a cluster. Read this beside when you actually need Kubernetes and Docker vs Swarm vs Kubernetes.
Quick start (under a minute)
Put each process (web, worker, database) in a Compose services block, wire them on a default network, and persist database files in a named volume [2]. From the project directory run docker compose up -d per Docker docs [1].
If every developer can boot the full stack with one command, you already have most of what a small production needs on one host [3].
Model the app as services, networks, and volumes
Compose's application model: services are the units you scale; they communicate over networks; they store durable data in volumes; configs and secrets mount as files [2]. A project name groups one deployment so two installs of the same file can coexist on one Engine host [2]. Default file name: compose.yaml (Compose still accepts older docker-compose.yml names) [2].
The diagram is the documented mental model [2], not every optional Compose feature. Health checks, profiles, and watch mode are extras you add when the basics work.
Sketch a minimal compose.yaml
services:
web:
build: .
ports:
- "8080:8000"
depends_on:
- db
environment:
DATABASE_URL: postgres://app:secret@db:5432/app
db:
image: postgres:16
volumes:
- pgdata:/var/lib/postgresql/data
environment:
POSTGRES_USER: app
POSTGRES_PASSWORD: secret
POSTGRES_DB: app
volumes:
pgdata:Per Docker's application model, service DNS names match service keys, so db resolves inside the compose network [2]. Change passwords in real deploys; this block is teaching structure only.
Check Compose on this draft host
docker compose versionObserved on this draft host (Linux x86_64, 2026-12-03):
bash: docker: command not foundThis VM does not include Docker Engine. Per Docker docs, a machine with the Compose plugin installed prints a Docker Compose version v2.x line from that command [1]. Run it on your VPS before you trust production deploy scripts.
When Engine is present, the documented boot sequence is:
docker compose up -d
docker compose psYou should see the Compose plugin version on the first command when installed, then running services listed for the project [1] [2].
Use Compose in staging and single-server production
Docker's production howto: the same definition can run in CI, staging, and production; the easiest deploy is one server, similar to development [3]. For production tweaks, add an overlay such as compose.production.yaml (drop code bind mounts, set restart: always, change ports) and merge with -f [3]:
services:
web:
restart: always
ports:
- "443:8000"docker compose -f compose.yaml -f compose.production.yaml up -dRebuild and recreate one service after code changes with docker compose build and up --no-deps -d as the docs show [3]. Isolation under those containers is still namespaces and cgroups.
Keep operations boring on one host
Back up the named volume or the database inside it on a schedule. nginx or a cloud load balancer in front of the published port on a single VPS is still the boring-box pattern (boring production box checklist).
Schedule volume dumps with cron on the host or a sidecar container that only runs the backup command. Store artifacts off the VPS disk. Restore quarterly to a scratch instance per your runbook, not only when production is on fire.
Log rotation belongs in the compose file or host journald settings. Unbounded database logs on a small disk fill the partition faster than traffic growth does.
Run Compose in CI before production
Docker docs position the same compose definition for development, CI, staging, and production [3]. In CI, run docker compose up -d, wait for health checks if you defined them, then hit integration tests against the published service ports or internal network aliases [2] [3].
Pin image digests or minor version tags when CI must be reproducible. latest is fine for local iteration; production overlays deserve pins you can diff in git blame.
When CI and the laptop differ only by overlay files, you shrink environment drift to overlay drift. That is still progress.
Use the same compose project name in CI so integration tests hit the same network aliases developers use locally [3]. Drift between CI YAML and laptop YAML is a common silent failure mode.
Secrets: prefer Docker secrets or env files excluded from git per Docker production guidance, not literals committed beside compose.yaml [3]. Rotate credentials when people leave; compose does not replace access review.
Climb only when Compose's host story breaks
Kubernetes overview triggers (multi-node desired state, rolling fleets, scheduling across many machines) live in when you actually need Kubernetes [4]. Compose on one host is not a failure mode. It is the documented first production shape [3]. Swarm remains a middle option in the comparison post when you want multi-node without full Kubernetes complexity [6].
| Signal you can measure | Stay on Compose? |
|---|---|
| One or two VMs carry production load | Yes, with overlays and backups [3] |
| You need rolling deploy across N nodes without downtime budgets | Revisit cluster docs [4] |
| Bin packing many teams on shared metal | Revisit cluster docs [4] |
| Resume wants "Kubernetes" | No; fix the resume, not the architecture |
Traps I still see
Treating Compose as dev-only. Docker's production howto explicitly covers single-server production [3]. The gap is operations discipline, not the file format.
Committing production secrets into compose.yaml. Use env files, secret mounts, or your host's secret store; keep git clean [3].
Bind-mounting source code in production. Overlays exist to remove dev mounts so containers run the image you built [3].
Jumping to Kubernetes for health checks Compose already supports. Add healthcheck keys and monitoring first [2].
depends_on waits for database readiness. Compose starts order; your app still needs retry logic for DB connections [2].
You need Swarm for two containers. Two services on one Engine host are the core Compose story [1].
Keep compose.yaml in git and overlay prod settings only after staging proves the same file boots cleanly. When the room starts chanting cluster names before backups exist, read when you actually need Kubernetes against the triggers in the table above, then compare orchestrator overhead in Docker vs Swarm vs Kubernetes. Until those signals show up in metrics, a single restorable box plus boring production box checklist discipline often ships more calmly than premature Helm.
Run docker compose config before every deploy, so a typo in the file fails on your laptop instead of on the server at midnight.
Send this to the teammate shopping Kubernetes before Compose has two services.

Keep this guide
Filed under Dev explainers, Dev tools
Questions about this guide
What is Docker Compose for?
Docker docs: a tool to define and run multi-container applications from a Compose file, then create and start all services with one workflow. The file is version controlled with your app.
Can Compose run in production?
Yes. Docker's production howto says you can use the same definition in CI, staging, and production, often on a single server first, with a production overlay file for restarts and ports.
When do I leave Compose?
When you need multi-node failover, fleet-wide rolling deploys across many hosts, or bin packing under real load. Those are Kubernetes overview triggers, not resume keywords.
Does Compose replace Docker Engine?
No. Compose orchestrates services, networks, and volumes on top of Engine. Isolation depth still lives in namespaces and cgroups.
Is one compose.yaml enough for prod?
Often start there. Docker's production guide recommends overlay files for restart policies, published ports, and removing dev bind mounts.
Sources
- Docker Docs: Compose overview, accessed 2026-12-03docs.docker.com
- Docker Docs: Use Compose in production, accessed 2026-12-03docs.docker.com
- Kubernetes docs: Overview, accessed 2026-12-03kubernetes.io
- Full Byte Developer: When you actually need Kubernetesfullbytedeveloper.com
- Full Byte Developer: Docker vs Swarm vs Kubernetes plain comparisonfullbytedeveloper.com
- Full Byte Developer: Docker namespaces and cgroupsfullbytedeveloper.com