Docker and Kubernetes work at different layers, so the choice most teams face is Docker Compose on one host or a Kubernetes cluster, not one tool against the other. Kubernetes removed its built-in Docker integration (dockershim) in v1.24 (2022) and now talks to containerd or CRI-O directly, yet images built with Docker run unchanged because they are OCI images. In our own calculation (a model, not a test) at one hourly rate of $150, the engineer time a managed three-node cluster needs costs $2,250 a month more than multi-container Compose, before any infrastructure bill. Stay on Compose until one of the five signs below applies.
Don't miss new tech stories on Google
Add Tech Insider once in the Google app and our stories appear in your news suggestions.
Docker builds and runs the image, Kubernetes places it on machines
A Dockerfile produces an OCI image. The Open Container Initiative, founded in 2015 under the Linux Foundation, maintains three specifications (image, runtime and distribution), according to the same runtime reference. Since Docker Engine 29, new installs use containerd’s image store, so Docker and containerd share one set of images. CRI-O is the other runtime Kubernetes can use: an implementation of the Kubernetes Container Runtime Interface that lets it run OCI-compatible runtimes.
| Layer | What sits there |
|---|---|
| Image format | OCI image, built from a Dockerfile |
| Node runtime | containerd or CRI-O |
| Orchestration on one host | Docker Compose, for multi-container applications |
| Orchestration across hosts | Kubernetes: Pods, Deployments, Services |
Production is a legitimate home for Compose: Docker’s Compose page says it works in “production, staging, development, testing, as well as CI workflows”. The SKA developer documentation says Docker is still the most used containerization engine and attributes that to its wider ecosystem, while the same page describes the Podman alternative as daemonless where Docker is client-server.
Where a cluster adds something Compose does not
The Kubernetes overview lists automated rollouts and rollbacks, self-healing, horizontal scaling, service discovery and secret and configuration management among its features. Compose covers the last two on one host. The first three are what a single machine cannot offer.
| Need | Compose on one host | Kubernetes cluster |
|---|---|---|
| Survive a lost machine | Service is down until the host returns | Pods are rescheduled onto other nodes |
| Scale past one machine | A bigger host | More replicas spread across nodes |
| Release without downtime | Recreate the service | Rolling update with rollback |
| Service discovery | Project network, service names resolve automatically | Service objects and cluster DNS |
| Health checks | healthcheck on each service | Liveness, readiness and startup probes |
| Config and secrets | Environment variables and env files | ConfigMaps and Secrets |
Kubernetes also takes longer to learn than Compose. That is an editorial judgement, and the next section prices it as 20 engineer hours a month against 5.
A month of engineer time on one hourly rate: a managed cluster costs $2,250 more than Compose
This cost model is our own calculation, not a test. The inputs below are modelled assumptions, not measurements: monthly engineer hours of 2 (single Docker server), 5 (multi-container Compose) and 20 (managed cluster), each hour priced at $150. Monthly engineer cost = hours x $150. Infrastructure bills and Docker licence fees are not in the model; add your own provider bill to each column.
| Monthly line | Single Docker server | Compose, multi-container | Managed Kubernetes, three nodes |
|---|---|---|---|
| Engineer hours | 2 | 5 | 20 |
| Engineer time at $150 an hour | $300 | $750 | $3,000 |
Against Compose, the cluster needs 15 extra hours a month, which is $2,250. At $100 an hour the same gap is $1,500. Replace the rate and hours with your own and recompute the gap with the formula above.
On these inputs a cluster pays for itself only if it removes more than about $2,250 a month of downtime, manual scaling or release effort, plus any extra infrastructure bill.
Five signs one Compose host has run out of road, and two that only look like signs
- A machine failure must not take the service down, so pods have to be rescheduled onto healthy nodes.
- Load has to spread across several machines rather than a bigger one.
- Releases must roll out gradually, with rollback and no downtime.
- Several teams share the platform and need separate access and policy.
- The downtime, manual scaling or release effort you already carry costs more than the $2,250 monthly gap in engineer time.
Two things that look like signs are not. Industry adoption of Kubernetes says nothing about whether your own workload needs a cluster. Container count is not a trigger either: Docker’s guide recommends one process per container so each piece can be swapped, upgraded, restarted and scaled on its own, so even a small application has several containers, and Compose is documented as a production tool.
If you do move, a managed cluster hands control-plane operation to the provider. Self-running the control plane adds operating work, which this model prices at $150 an hour, so weigh each extra hour against what your provider charges you for the control plane.
What changes on the node: containerd, cgroup v2 and no Docker daemon
Images carry over. Infosys’ page on the CNCF ecosystem notes that Kubernetes v1.24 standardizes on cri-o and containerd, both OCI compliant, so any image built on OCI specifications keeps running. Because nodes talk to those runtimes directly, anything in your pipeline that assumed a Docker daemon on the node needs a replacement.
Check hosts before joining them to a cluster: Kubernetes deprecated cgroup v1 in v1.35, and the kubelet refuses to start on a cgroup v1 node unless failCgroupV1: false is set. Also note that all containers on a host share one kernel, which gives speed and density but means a kernel vulnerability reachable from inside a container can compromise the host. On a cluster, that host is a node running every workload scheduled to it.
One Compose file translated into Kubernetes objects, key by key
Docker’s guide shows what Compose replaced: wiring a two-container app by hand took 14 flags across three commands, where one typo breaks the connection. Compose also creates a network per project, so service names resolve with no extra configuration; in Kubernetes that job falls to Service names and cluster DNS. The Kubernetes docs carry a task page, Translate a Docker Compose File to Kubernetes Resources, whose output is a starting point to review rather than a finished deployment.
| Compose key | Kubernetes object | What to do |
|---|---|---|
| services | Deployment plus Service | One Deployment per service, one Service for traffic |
| ports | Service, Ingress for outside traffic | Map the container port to the Service port |
| environment | ConfigMap or Secret | Credentials go in a Secret |
| volumes | PersistentVolumeClaim | Database state: StatefulSet or a managed database |
| restart | Pod restart policy | Deployments restart failed containers |
| healthcheck | Liveness, readiness, startup probes | Add probes explicitly |
| depends_on | No direct counterpart | Readiness probe, init container or retry in the app |
| project network | Cluster DNS | Use Service names as hostnames |
Fix the Compose file first. Docker’s guide notes that without a healthcheck, Compose can only wait for the container to start, which is before MySQL accepts connections. This version gates the web service on Postgres readiness and pins both image tags.
services:
web:
image: myapp:1.4.2
ports:
- "3000:3000"
environment:
DATABASE_URL: postgres://myapp:${DB_PASSWORD}@db:5432/myapp
depends_on:
db:
condition: service_healthy
restart: always
db:
image: postgres:16.4
environment:
POSTGRES_DB: myapp
POSTGRES_USER: myapp
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U myapp -d myapp"]
interval: 5s
retries: 10
volumes:
pgdata:
The condition: service_healthy gate does not copy across. In the manifests below the readiness probe keeps traffic away from a pod that is not ready, and the database is addressed by hostname as a managed service. If it stays in the cluster it needs a StatefulSet and a PersistentVolumeClaim.
# Keep real credentials out of Git: create this Secret with kubectl or an external secrets tool.
apiVersion: v1
kind: Secret
metadata:
name: db-credentials
type: Opaque
stringData:
url: postgres://myapp:[email protected]:5432/myapp
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
spec:
replicas: 2
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: web
image: myapp:1.4.2
ports:
- containerPort: 3000
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: db-credentials
key: url
readinessProbe:
httpGet:
path: /ready
port: 3000
livenessProbe:
httpGet:
path: /health
port: 3000
---
apiVersion: v1
kind: Service
metadata:
name: web
spec:
selector:
app: web
ports:
- port: 80
targetPort: 3000
A common Dockerfile pattern runs npm ci –only=production before npm run build, which breaks builds when the build tools sit in devDependencies, as they usually do. Install everything in the builder stage and only production dependencies in the runtime stage:
# Build with --build-arg NODE_VERSION set to the Node LTS version you pin.
ARG NODE_VERSION
FROM node:${NODE_VERSION}-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:${NODE_VERSION}-alpine
WORKDIR /app
ENV NODE_ENV=production
COPY package*.json ./
RUN npm ci --omit=dev
COPY --from=builder /app/dist ./dist
USER node
EXPOSE 3000
HEALTHCHECK --interval=30s CMD wget -qO- http://localhost:3000/health || exit 1
CMD ["node", "dist/server.js"]
Your first three actions, in order:
- Add a healthcheck to every stateful service in the Compose file and gate dependants on it.
- Pin every image tag, replacing latest and floating tags with exact versions.
- Generate the Kubernetes manifests with the Kubernetes docs translation task, then review each object against the mapping table above.




