Skip to main content
Docker Compose in Production: When It Fits and When It Doesn't

Docker Compose in Production: When It Fits and When It Doesn't

KU
· Founder & Chief Editor
• 7 min read•Updated •34 views

Everyone says Compose is for dev only. We ran it in production for two years on a single node and it was the right call, until the day it very much wasn't.

Key takeaways

  • Docker Compose works in production when the whole workload fits on one node, one team owns deploys, and a rare reboot of downtime is acceptable.
  • Make it safe with restart policies, healthchecks, service_healthy dependencies, resource limits and log rotation.
  • Move to an orchestrator when you need more nodes, multi-zone failover or isolated team deploys.

Docker Compose is fine in production when your whole workload fits on one node, one team owns the deploys, and you can tolerate a reboot's worth of downtime. Harden it with restart policies, healthchecks, depends_on with service_healthy, resource limits and log rotation. Move to an orchestrator when you need multiple nodes, multi-zone failover, or independent team deploys.

Verified against

Docker Compose v5.6.1 (released 2026-10-21), against the docs.docker.com Compose production guide, startup-order guide and Compose file deploy specification. Checked October 2026.

A consultant told our founder that running Docker Compose in production was "amateur hour" and we needed Kubernetes. At the time we were serving tens of thousands of daily active users off a single Compose file on one large VM, with uptime nobody was complaining about. We ignored the consultant for another 18 months, and it was the correct decision. Then our traffic pattern changed and Compose stopped fitting, cleanly and obviously. Both facts are true, and the interesting part is knowing which situation you're in.

Why single-node Compose is fine more often than people admit

The dirty secret is that a huge number of production workloads fit on one machine. A modern VM with 16 vCPUs and 64GB of RAM is a lot of computer. If your app, its background workers, and a couple of supporting services fit there with headroom, an orchestrator's job (scheduling containers across many nodes) is solving a problem you don't have. You're paying the full operational cost of Kubernetes to schedule pods onto the one node you own. Docker's own production guide says the easiest way to deploy is to run Compose on a single server, much like your development environment.

Our production Compose file wasn't a dev toy. It was tuned for it:

compose.yaml
services:
  api:
    image: registry.devopsness.net/api:2026.06.30
    restart: unless-stopped
    deploy:
      resources:
        limits:
          cpus: "4"
          memory: 4g
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3000/healthz"]
      interval: 10s
      timeout: 3s
      retries: 3
      start_period: 20s
    logging:
      driver: json-file
      options:
        max-size: "50m"
        max-file: "5"
    depends_on:
      db:
        condition: service_healthy

The pieces that make this production-grade: restart: unless-stopped so containers come back after a crash or reboot, real healthchecks so Docker knows when a service is actually ready, depends_on with condition: service_healthy so the API doesn't start hammering a database that isn't up yet, and log rotation so a chatty service doesn't fill the disk and take the box down. That last one has killed more single-node deployments than anything else.

The deploy that avoided downtime

The usual objection is that Compose can't do zero-downtime deploys. It can, with a caveat. docker compose up -d recreates changed services, and with a healthcheck plus a small script you get rolling behavior on a single service by scaling up before scaling down. Remove the old container explicitly, because scaling back to one replica does not promise to keep the newest one:

Bash
OLD=$(docker compose ps -q api)
docker compose pull api
docker compose up -d --no-deps --scale api=2 --no-recreate api
sleep 15   # let the new container pass its healthcheck
docker stop "$OLD" && docker rm "$OLD"
docker compose up -d --no-deps --scale api=1 --no-recreate api

This only works if the service has no container_name and publishes no fixed host port, since two replicas can't bind the same one. We fronted it with an Nginx that health-checked upstreams, so traffic only went to a container passing /healthz. Not elegant, but it delivered zero-downtime deploys for two years. The honest limitation: this is a manual dance, and it only works because we had exactly one node and one service that mattered.

Where it actually broke

The move to Kubernetes wasn't ideology. It was three specific things arriving at once.

First, a marketing campaign meant traffic could 5x in an hour, and we needed to add capacity automatically. Compose has no autoscaling and no second node to scale onto. Second, a single VM is a single point of failure, and we'd promised an enterprise customer a multi-AZ SLA that one machine physically cannot meet. Third, we grew to four teams deploying independently, and a shared Compose file became a merge-conflict and blast-radius problem, because one team's bad deploy could take down the whole node.

None of those are "Compose is bad." They're "our requirements outgrew one machine." When you need scheduling across nodes, automatic failover across zones, and independent team deploys, you need an orchestrator, and that's genuinely what Kubernetes is for. If you are still deciding whether you are at that line, our take on whether you need Kubernetes at all walks the same thresholds, and Kubernetes vs Docker Swarm covers the lighter multi-node step in between.

The migration wasn't a rewrite

Because we'd kept the Compose file clean, moving to Kubernetes was mostly mechanical translation: services became Deployments, the healthchecks became readiness and liveness probes almost verbatim, resource limits carried over directly, and depends_on logic moved into init containers. Kompose got us a rough draft we then cleaned up by hand. Having disciplined resource limits and healthchecks already in place made the port far less painful than starting from a sprawling Compose file with no limits at all.

If your services still start from long docker run lines, the docker run to Compose converter turns each one into a compose.yaml service you can commit.

Questions people ask

Is Docker Compose good for production?

Yes, for single-host workloads. Docker's documentation describes running Compose on a single server as the simplest deployment path. It is a good fit when everything fits on one machine with headroom, one team deploys, and occasional host maintenance downtime is acceptable. It is a poor fit once you need autoscaling, more than one node, or failover across availability zones, because Compose schedules nothing beyond the host it runs on.

Can Docker Compose do zero-downtime deploys?

Not natively, but you can approximate it on one host. Scale the service to two replicas with --no-recreate, wait for the new container's healthcheck to pass, remove the old container, then scale back to one. A reverse proxy that health-checks upstreams keeps traffic off containers that aren't ready. The service must not set container_name or bind a fixed host port, or the second replica can't start.

When should I move from Docker Compose to Kubernetes?

Move when you hit a requirement one machine cannot satisfy: capacity beyond a single node, automatic failover across zones for an SLA, or several teams that need isolated deploys and blast radius. Traffic spikes that need automatic scale-out are the most common trigger. If none of those apply, Kubernetes adds daily operational cost for scheduling onto the one node you already have.

The call we'd make

Run Compose in production if your whole workload fits comfortably on one node, you can tolerate the rare reboot's worth of downtime, and one team owns the deploys. That describes a lot of real businesses, and reaching for Kubernetes there is cargo-culting operational complexity you'll pay for daily. Move to an orchestrator when you cross a real line: you need more than one node's capacity, you need automatic multi-zone failover for an SLA, or you have multiple teams that need isolated blast radius. Don't switch because a consultant made you feel amateur. Switch because you hit a requirement one machine cannot satisfy, and keep your Compose file clean so that when the day comes, the move is a translation and not a rebuild.

Sources

Explore topics:DockerDevOps
React
Share this post
Cite this article
Plain text

Kiril Urbonas (2026). Docker Compose in Production: When It Fits and When It Doesn't. DevOpsNess. Updated 2026-11-15. https://www.devopsness.com/blog/docker-compose-in-production-when-it-fits

Markdown

[Docker Compose in Production: When It Fits and When It Doesn't](https://www.devopsness.com/blog/docker-compose-in-production-when-it-fits) (Kiril Urbonas, DevOpsNess, updated 2026-11-15)

KU

Kiril Urbonas

Founder & Chief Editor

604 articles
View all articles by Kiril Urbonas

You might have missed

Evergreen posts worth revisiting.