A single barge carrying one shipping container next to a harbor crane loading three barges stacked with containers
DevOps Engineering

Kubernetes vs Docker: What Each Does and When You Need Both

Docker runs containers on 1 machine, Kubernetes across many. Code side by side, costs, and 5 questions.

Michael Zion

15 min read

Docker and Kubernetes do 2 different jobs, and the choice you are really making is between 1 machine and many:

Bottom line

  1. Docker = build an image and run it as a container on 1 machine. A laptop, a CI runner or a single server
  2. Kubernetes = keep containers running across many machines. It places them, restarts them, replaces them and routes traffic to them
  3. They work together. You build the image with Docker, push it to a registry, and Kubernetes runs it
  4. Kubernetes stopped using Docker Engine in v1.24. Nodes on EKS, GKE and AKS run containerd. Your Docker-built images run on it unchanged
  5. The real comparisons are Docker Compose vs Kubernetes and Docker Swarm vs Kubernetes. Both come down to how many machines you have to survive losing
DockerKubernetes
JobBuild images, run containersRun containers across a cluster
Scope1 machine by defaultUp to 5,000 nodes
You writeA Dockerfile, a compose.yamlYAML manifests
If the machine diesThe app is downPods are rescheduled on other nodes
Price of the softwareEngine is free and open sourceOpen source. A managed control plane is $0.10 an hour
Kubernetes vs Docker: Docker runs containers on 1 machine, Kubernetes runs containers on many nodes under a control plane
Docker = 1 machine. Kubernetes = many.

What to do, by where you are today:

Your situationWhat I would do
1 product, 1 server, a small teamDocker Compose with a restart policy and a healthcheck
Containers in the cloud and nobody to run a platformECS on Fargate, Cloud Run or Azure Container Apps
Several teams, many services, deploys every dayManaged Kubernetes: EKS, GKE or AKS
Already on Docker Swarm and it worksStay. Plan the move the day you need something it lacks
On Kubernetes with scripts that call docker on the nodesReplace them with kubectl and crictl

Deciding whether your product needs Kubernetes yet? Book a free consultation call to examine what it would take to get your DevOps setup production-grade: environments, deployments, monitoring, security, and costs.

Find your situation:

Docker builds and runs containers on 1 machine

Docker is 4 things that people call by 1 name.

  1. A build tool. docker build reads a Dockerfile and produces an image
  2. An image format. An image is a package of everything the app needs to start: OS files, runtime, dependencies, code
  3. A registry. Docker Hub stores images so other machines can pull them
  4. An engine. Docker Engine runs the image as a container on the machine it is installed on

A container, in Docker's own words, is "an ordinary process on your computer" that runs in isolation.

It shares the machine's kernel, which is what makes it lighter than a virtual machine.

Inside Docker Engine there are 3 layers:

dockerd (the daemon and its API) โ†’ containerd (the container lifecycle) โ†’ runc (starts the process)

Remember containerd. It comes back in the Kubernetes story.

Docker Desktop is the app for Mac, Windows and Linux that bundles the Engine, the CLI, Compose and a local Kubernetes.

Docker Engine is free and open source. Docker Desktop needs a paid subscription for companies with 250 or more employees or $10 million or more in annual revenue.

Docker = 1 machine. Out of the box, everything Docker Engine does, it does on the host it runs on. (Swarm mode, further down, is the exception you switch on.)

Kubernetes keeps containers running across many machines

The Kubernetes site defines it as "an open source system for automating deployment, scaling, and management of containerized applications."

In simple words: you tell Kubernetes what should be running, and it keeps it running across a group of machines.

A cluster has 2 parts:

  • The control plane: the API server, etcd (the database), the scheduler and the controllers
  • The nodes: machines that run your containers. Each one runs a kubelet and a container runtime

What it does that a single Docker host does not:

  1. Scheduling. You say how much CPU and memory a container needs. Kubernetes picks the node
  2. Self-healing. A failed container is restarted. A failed node's workloads are rescheduled on other nodes
  3. Rollouts and rollbacks. New Pods come up while old ones go down, at a controlled rate. By default at most 25% are unavailable at a time
  4. Service discovery and load balancing. A Service gives a changing set of Pods 1 stable name
  5. Autoscaling. More Pods when CPU rises, more nodes when Pods do not fit. Both need an add-on: Metrics Server and a node autoscaler
  6. Config and secrets. Changed without rebuilding the image

Kubernetes v1.37 supports clusters of up to 5,000 nodes and 150,000 Pods.

The docs also list what Kubernetes is not, and this is the part most comparisons skip:

  • It "does not deploy source code and does not build your application". You still need something that builds images
  • It "does not dictate logging, monitoring, or alerting solutions". You bring those
  • It does not come with a database, a cache or a message bus
  • A Service of type LoadBalancer needs a cloud, or a load balancer you provide: "Kubernetes does not directly offer a load balancing component"

Kubernetes = many machines that behave like 1. You pay for that with moving parts.

Kubernetes stopped using Docker Engine in v1.24

In December 2020 the Kubernetes project announced it was deprecating Docker as a container runtime.

The internet read it as "Kubernetes is dropping Docker". The project later admitted: "We didn't do a great job communicating this".

What actually happened:

  1. In the early days Kubernetes supported 1 runtime: Docker Engine
  2. Kubernetes then defined the Container Runtime Interface (CRI), so the kubelet could talk to any runtime
  3. Docker Engine does not speak CRI, so Kubernetes carried an adapter inside the kubelet, called dockershim
  4. v1.20 announced the removal of dockershim. v1.24 removed it
  5. Nodes now run a CRI runtime directly, and the common one is containerd

Before v1.24, with Docker as the runtime: kubelet โ†’ dockershim โ†’ Docker Engine โ†’ containerd โ†’ runc

Since v1.24: kubelet โ†’ containerd โ†’ runc

Kubernetes stopped using Docker Engine in v1.24. Before: kubelet, dockershim, Docker Engine, containerd, runc. Since: kubelet, containerd, runc
The 2 pink boxes left the chain. containerd and runc stayed.

Kubernetes cut out the middle of the chain. The part that starts your container was containerd before, and it is containerd now.

The 3 big managed services agree: EKS-optimized Amazon Linux images come with containerd, GKE uses containerd on all node images, and AKS uses containerd on Linux node pools.

Your Docker images still run

The Kubernetes blog, in a post titled "Don't Panic: Kubernetes and Docker": "Docker-produced images will continue to work in your cluster with all runtimes, as they always have."

Why? An image built by Docker is an Open Container Initiative (OCI) image. containerd and CRI-O both pull and run OCI images.

Docker on your laptop and in your CI is unaffected. Building with Docker does not make you depend on Docker as a runtime.

What changes on a node

  • docker ps and docker exec do not see Kubernetes containers. They are "not visible to Docker"
  • An image you build with docker build on a node is invisible to Kubernetes until you push it to a registry
  • A Pod that mounts /var/run/docker.sock to build images breaks
  • Monitoring or security agents that expect Docker Engine on the node need a version that talks to containerd

The replacements:

# Which runtime does each node use? Read the CONTAINER-RUNTIME column
kubectl get nodes -o wide

# On the node itself, instead of docker ps
crictl ps -a

You can still run Docker Engine under Kubernetes through an adapter called cri-dockerd, maintained by Mirantis and Docker. I would only do it for a workload that truly needs the Docker socket.

containerd vs Docker is a part vs the whole

containerd was born at Docker in 2014 as the lower layer of the Docker engine. Today it is a graduated Cloud Native Computing Foundation (CNCF) project.

Docker Engine = containerd + a build tool + a CLI + an API + networking and volumes for 1 host.

A Kubernetes node needs only the first item on that list. GKE says it plainly: "You cannot use containerd to build container images."

So you keep both: Docker where images are built, containerd where they run.

The same web server in Docker, Compose, Swarm and Kubernetes

4 ways to run nginx, from the smallest to the largest. Every command and field below is taken from the Docker and Kubernetes references.

1. docker run: 1 container

docker run -d -p 8080:80 --name web --restart unless-stopped nginx

-d runs it in the background, -p 8080:80 publishes container port 80 on host port 8080, and --restart unless-stopped brings it back after a crash or a reboot.

2. Docker Compose: 1 application on 1 host

# compose.yaml
services:
  web:
    image: nginx:latest
    ports:
      - "8080:80"
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost"]
      interval: 1m30s
      timeout: 10s
      retries: 3
docker compose up -d

The command in test runs inside the container, so the image has to contain it.

3. Docker Swarm: several hosts, Docker commands

docker swarm init --advertise-addr <MANAGER-IP>

docker service create --name web \
  --replicas 3 \
  --publish published=8080,target=80 \
  nginx

docker service update --image nginx:stable web
docker service update --rollback web
docker service scale web=5

Port 8080 answers on every node of the swarm, including nodes that run no copy of the service.

4. Kubernetes: a cluster, declared in YAML

# web.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
  labels:
    app: web
spec:
  replicas: 3
  selector:
    matchLabels:
      app: web
  template:
    metadata:
      labels:
        app: web
    spec:
      containers:
      - name: web
        image: nginx:latest
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: web
spec:
  type: LoadBalancer
  selector:
    app: web
  ports:
  - port: 80
    targetPort: 80
kubectl apply -f web.yaml
kubectl rollout status deployment/web

kubectl set image deployment/web web=nginx:stable
kubectl rollout undo deployment/web

kubectl scale deployment/web --replicas=5
kubectl autoscale deployment web --min=2 --max=10 --cpu=60%

1 line became about 30. They buy you 3 copies that the scheduler tries to spread across machines, a cloud load balancer in front of them, and a rollout you can undo.

If you need the rest of the commands, the kubectl cheat sheet lists them by task.

Docker Compose vs Kubernetes: 1 host vs a cluster

"Docker for development, Kubernetes for production" is what half the internet tells you.

Docker disagrees: "Compose supports production deployments on single hosts."

I agree with Docker. A single server running Compose is a fine production setup for a product with 1 team and a tolerance for a few minutes of downtime.

What Compose gives you in production:

  • Restart policies: restart: unless-stopped brings a container back after a crash or a daemon restart
  • Healthchecks: Docker marks a container healthy or unhealthy. It does not restart an unhealthy one by itself
  • Override files: docker compose -f compose.yaml -f compose.production.yaml up -d
  • Remote deploys: point DOCKER_HOST at the server

Where it ends:

Docker ComposeKubernetes
Machines1 hostA cluster of nodes
The host diesEverything on it is downPods move to other nodes
Deploying a new versionStops and recreates the containerRolling update, old and new overlap
RollbackDeploy the previous image againkubectl rollout undo
ScalingBy hand, within 1 hostBy hand or automatic, across nodes
SecretsEnvironment variables and filesSecret objects (unencrypted in etcd by default in upstream Kubernetes)
Time to learn (my estimate)An afternoonMonths

The 2 rows that matter are the first 2. Compose = 1 host. When 1 host is no longer acceptable, you need a scheduler.

2 traps on the way out of Compose:

  1. The deploy section (replicas, update_config, placement) is an optional part of the Compose Specification. A platform that does not support it ignores it, and the file is still valid
  2. docker stack deploy, the Swarm command that takes a Compose file, reads only the legacy version 3 format. The current Compose Specification format "isn't compatible" with it

To move a Compose file to Kubernetes, start with a converter and then edit by hand: kompose convert (a Kubernetes project) or docker compose bridge convert (Docker Desktop 4.43.0 and later).

(The converter writes the YAML. It does not write your readiness probes, your resource requests or your on-call rotation.)

Docker Swarm vs Kubernetes: the smaller cluster

Swarm mode is the clustering that ships inside Docker Engine. No extra software, 1 command to start: docker swarm init.

It does more than its reputation says:

  • Replicated services that are rescheduled when a node fails
  • Rolling updates, 1 task at a time by default, with rollback
  • A routing mesh, so every node answers on a published port
  • Service discovery through built-in DNS
  • Secrets, encrypted in transit and at rest
  • Mutual TLS between nodes by default
Docker SwarmKubernetes
InstallBuilt into Docker EngineA managed service, or a project of its own
Control plane3 or 5 manager nodes. Docker recommends 7 at mostAPI server, etcd, scheduler, controllers
ScalingYou set the number of replicasYou set it, or an autoscaler does
Managed offering on AWS, Google Cloud, AzureNoneEKS, GKE, AKS
EcosystemDocker toolingHelm, operators, Gateway API, most vendors
Commercial supportMirantisEvery cloud and most vendors

Is Swarm dead? No.

Classic Swarm, the 2014 standalone project, is archived, and Docker Engine dropped support for it in v23.0. Swarm mode is still in the Engine.

Mirantis, which sells it commercially, wrote in July 2025: "Swarm will be fully supported through at least 2030 as part of Mirantis Kubernetes Engine 3."

The Swarm docs describe no autoscaler: you declare the number of tasks and the manager keeps it.

My position: a Swarm that works today is no emergency. For a new platform I would not pick it, because the people, the tools and the cloud services you will hire and buy next year all assume Kubernetes.

What Kubernetes costs before it runs your app

The software is free. Running it has 3 prices.

1. The control plane fee

ServiceStandardExtended support for an old version
Amazon EKS$0.10 per cluster per hour$0.60 per cluster per hour
Google GKE$0.10 per cluster per hour$0.60 per cluster per hour
Azure AKSFree tier, or Standard at $0.10 per cluster per hour (East US)$0.60 per cluster per hour for Long Term Support (East US)

$0.10 an hour = about $73 a month per cluster. Before nodes, load balancers and disks.

$0.60 an hour = about $438 a month per cluster. On EKS that is what a cluster nobody upgraded costs, because extended support is on by default. On GKE and AKS you pay it only if you opt in.

GKE gives $74.40 of credit a month per billing account, which covers 1 zonal or Autopilot cluster. Microsoft says its Free tier clusters "are not meant to run at scale (>10 nodes)".

2. The upgrade treadmill

  • Kubernetes ships about 3 releases a year
  • Each release gets about 1 year of patches
  • On EKS a version has 14 months of standard support, then the fee rises for 12 months, then AWS upgrades the control plane for you

Kubernetes = 1 upgrade project every few months, forever. (There is a guide for that too.)

3. Everything the docs say it does not include

An ingress or gateway controller. Metrics Server, without which autoscaling on CPU does nothing (GKE and AKS ship it). Logging. Monitoring. Encryption of Secrets at rest (off in upstream Kubernetes, on by default on EKS and GKE). A way to build images.

Each one is a choice, an install and something to upgrade.

The fee is the small part. The person who owns all of the above is the real price.

Containers without running Kubernetes yourself

Between "1 server with Compose" and "a Kubernetes cluster" there is a third option that most comparisons leave out.

ServiceWhat it isLimits worth knowing
Amazon ECS on FargateAWS's own orchestrator, with no servers to manage and no control plane feeFixed task sizes, from 0.25 vCPU up to 32 vCPU
Google Cloud RunRuns a container per request load and scales to zeroRequest timeout of 5 minutes by default, 60 at most. 8 vCPU and 32 GiB per instance
Azure Container AppsServerless containers, built on KubernetesNo access to the Kubernetes APIs. Up to 1,000 replicas per revision

AWS App Runner used to be on this list. It is closed to new customers, and AWS points them to ECS Express Mode.

These services take a Docker-built image, give you rollouts and autoscaling, and leave you no cluster to upgrade.

What you give up: the Kubernetes ecosystem and the option to run the same setup on another cloud or in a customer's data center.

If you are on AWS and stuck between the two, I compared them in ECS vs EKS.

When to move from Docker to Kubernetes

5 questions:

  1. Does the product have to survive the loss of a machine with nobody awake?
  2. Do you deploy several times a day and need every deploy to cause zero downtime?
  3. Do more than 2 teams deploy more than 10 services to the same environment?
  4. Does load change enough during the day that fixed capacity wastes real money?
  5. Do you need something only the Kubernetes ecosystem has: operators, GPU scheduling, a Helm chart your customers install on their own clusters?
5 questions before Kubernetes: survive losing a machine, zero downtime deploys, many teams and many services, load that changes, needs the ecosystem. 2 yes answers means you need a scheduler
The 5 questions on 1 card.

If you answered yes to 2 of the 5, you need a scheduler.

If the yes answers are only 1 and 2, a managed container service is enough.

If 3 or 5 is among them, it is Kubernetes.

The order I would walk it:

docker run โ†’ Docker Compose on 1 server โ†’ a managed container service โ†’ managed Kubernetes

From 1 container to a cluster: docker run, Docker Compose on 1 host, a managed container service, managed Kubernetes
4 steps. Most products can stop before the last one for a long time.

Skip a step when you have a reason. "Everyone uses Kubernetes" is a fact about everyone.

When you do move, pick a managed control plane. I wrote about the options in how to choose Kubernetes hosting for production, and about the move itself in how to plan a Kubernetes migration.

8 mistakes on the way from Docker to Kubernetes

MistakeFix
CI jobs in the cluster mount the Docker socket to build imagesBuild outside the cluster, or with a daemonless builder such as buildah or rootless BuildKit
Debugging a node with docker pscrictl ps -a on the node, kubectl everywhere else
Pulling public images from Docker Hub with no loginAuthenticate the pulls or mirror the images. The anonymous limit is 100 pulls per 6 hours per IPv4 address, and a cluster behind 1 NAT is 1 address
Image names without a registryKnow that Kubernetes assumes Docker Hub when the registry is missing
-p 80:80 on a server with a public IPDocker publishes on all interfaces and manages its own firewall rules. Bind to 127.0.0.1 when a reverse proxy sits in front
An autoscaler that never scalesCheck that Metrics Server is running (GKE and AKS ship it) and set CPU requests on the Pods
Copying kubectl autoscale ... --cpu-percent from an old tutorialThe current kubectl reference uses --cpu=60%
Docker Desktop on every laptop of a 300 person company with no subscriptionBuy the subscription, or use Docker Engine on Linux, which is open source

Kubernetes vs Docker checklist

Always:

  • Build images with Docker (or any OCI builder) and push them to a registry
  • Pin image tags. latest is for examples like the ones above
  • Set a restart policy and a healthcheck on anything that runs under Docker in production
  • Authenticate Docker Hub pulls from servers and clusters
  • Answer the 5 questions before choosing a platform
  • Take the managed control plane
  • Budget the upgrades: about 3 Kubernetes releases a year
  • Check that Metrics Server is running before you promise anyone autoscaling
  • Check the CONTAINER-RUNTIME column before you write a node script
  • Keep 1 person accountable for the cluster (shared accountability is how clusters reach extended support)

Kubernetes vs Docker FAQ

Which is better, Kubernetes or Docker?

Neither, because they do different jobs. Docker builds images and runs containers on 1 machine, Kubernetes runs containers across many machines, and you can use Docker to build what Kubernetes runs.

Is Kubernetes replacing Docker?

No. Kubernetes replaced Docker Engine as the runtime on its own nodes in v1.24, and developers kept Docker everywhere else. In the Stack Overflow 2026 survey, 59.1% of the developers who answered the cloud tools question had done extensive work with Docker or Docker Compose in the past year, and 26.0% with Kubernetes.

Can I use Kubernetes without Docker?

Yes, and on a managed cluster you already do. The nodes run containerd, and any tool that produces an OCI image can build for them.

Do I need to learn Docker before Kubernetes?

I would. Kubernetes runs images, and you cannot debug a Pod without knowing what an image, a container, a port and a volume are. Learn docker build, docker run and Compose first.

What is the difference between Docker Compose and Kubernetes?

Compose runs a multi-container application on 1 host. Kubernetes runs it across a cluster and replaces what fails. Start with Compose and move when 1 host stops being acceptable.

What is the difference between containerd and Docker?

containerd is the runtime inside Docker Engine that manages the container lifecycle. Docker adds the build tool, the CLI, the API and single-host networking on top of it. Most Kubernetes nodes run containerd alone.

Is Docker Swarm still supported?

Yes. Swarm mode ships in Docker Engine, and Mirantis has committed to supporting it through at least 2030 in its commercial product. Classic Swarm, the older standalone project, is archived.

Why are people moving away from Kubernetes?

In my view, the teams that leave are the ones that adopted it before they needed it. A cluster costs a control plane fee, an upgrade every few months and a person who owns it, and a product that fits on a managed container service gets none of that back.

A Recap!

If you take away 1 thing from this guide, let it be this:

Docker vs Kubernetes = 1 machine vs many. Count your machines before you pick a tool.

  1. Docker builds the image and runs it on 1 machine. Kubernetes keeps it running across many
  2. Kubernetes has not needed Docker Engine since v1.24. Your Docker-built images did not notice
  3. Compose is a production tool for 1 host. Docker says so
  4. A cluster costs $73 a month before it runs anything, and an owner after that
  5. 2 yes answers out of 5 = you need a scheduler. Kubernetes is 1 of 3 ways to get one

You don't NEED anyone for this. The 5 questions and the checklist above are the whole decision.

If you would rather talk it through with someone who has run both (yes, I sell DevOps engineers), book the free production setup consultation.