Kubernetes vs Docker Isn't a Contest: They Do Different Jobs
Docker builds and runs containers on one machine. Kubernetes decides where containers run across many machines and replaces the ones that die. Kubernetes even stopped talking to Docker Engine directly in version 1.24, and your images kept working.

Key takeaways
- Kubernetes and Docker are not alternatives: Docker packages an application into an image and runs it as a container on one machine, while Kubernetes schedules, scales, and replaces containers across a cluster of machines.
- The tools that actually compete with Kubernetes are Docker Compose (multi-container apps from one YAML file on a single host) and Docker Swarm mode (Docker's built-in cluster manager).
- Kubernetes 1.24, released May 3, 2022, removed dockershim, the built-in Docker Engine integration, and Docker-built images kept running because Kubernetes runs any image on a runtime that implements its Container Runtime Interface.
- Docker Desktop can start a local Kubernetes cluster, either single-node with kubeadm or multi-node with kind, so you can learn Kubernetes without leaving the Docker tooling you already use.
- A Kubernetes Deployment with replicas set to 3 keeps three copies of a pod running and replaces them gradually during an update, which is the part a single Docker host cannot do on its own.
Kubernetes vs Docker is a slightly broken question, because they aren't rivals. Docker packages an application into an image and runs it as a container on one machine. Kubernetes runs containers across many machines and keeps the right number of them alive.[1,2]
Think of Docker as the thing that makes the shipping container and Kubernetes as the port that decides which crane lifts it, which ship it goes on, and what happens when a crane breaks. You usually want both. The interesting part is that in 2022 Kubernetes stopped talking to Docker Engine directly, and almost nobody's deployments broke.
How the two fit together
Docker makes the image. Kubernetes runs it on a runtime it picks.
What you build
- DockerfileBuild instructions for one app
- Image in a registryPushed after docker build
- Deployment manifestSays how many copies to run
Kubernetes cluster
Schedules, scales, and replaces pods across nodes
What actually runs the containers
- containerd
- CRI-O
- Any runtime that speaks CRIContainer Runtime Interface
The image format is the handshake. Docker builds it, and the runtime doesn't have to be Docker.
Docker runs one container. Kubernetes manages a fleet.
Docker describes itself as “an open platform for developing, shipping, and running applications.” An image is “a read-only template with instructions for creating a Docker container,” and a container is “a runnable instance of an image.”[2]
That's the whole unit of work: build once, run anywhere Docker is installed. If you want the deeper mechanics of what a container is, I wrote that up in Docker vs virtual machines.
Kubernetes starts where that story gets uncomfortable. Its own docs define it as “a portable, extensible, open source platform for managing containerized workloads and services.” Google open sourced it in 2014.[1]
What you get is the list of chores you otherwise do by hand at 2 a.m.: restarting containers that fail, spreading traffic across copies, rolling out a new version at a controlled rate, and scaling up or down with a command or automatically on CPU usage.[1]
Summary
Here is the comparison that matters, with the tools people actually weigh against Kubernetes in the middle rows.
| Tool | What it manages | How many machines |
|---|---|---|
| Docker (Engine and CLI) | Images and single containers | One |
| Docker Compose | Multi-container apps from one YAML file | One |
| Docker Swarm mode | Services, with a declared number of tasks | A cluster of Docker Engines |
| Kubernetes | Pods, Deployments, networking, rollouts, scaling | A cluster of nodes |
Sources: Docker overview, Compose, and Swarm documentation; Kubernetes overview.
The real rivals are Compose and Swarm
Docker Compose is “a tool for defining and running multi-container applications,” managed from “a single YAML configuration file.”[3] A web app, a database, and a cache become one file and one command. For local development that is hard to beat, and I'd start there for anything that fits on one machine.
Swarm mode is Docker's own answer to the cluster problem. The docs call it a way of “natively managing a cluster of Docker Engines,” where for each service you “declare the number of tasks you want to run” and the manager adds or removes tasks to match.[4]
That's the same declare-the-state idea as Kubernetes, with fewer concepts to learn.
So why did Kubernetes become the default for clusters anyway? I can't give you a market share number I've verified, so I won't.
What I can say is what the Kubernetes docs lead with: it isn't only a scheduler, it is a platform other tools build on, and that extensibility is the pitch.[1] If you are choosing today, the practical tiebreaker is which one your cloud provider and your hiring pool already speak.
Kubernetes dropped Docker Engine in 1.24, and your images still ran
This is the part that confuses people, so here is the plain version. Kubernetes releases before 1.24 included a direct integration with Docker Engine, a component called dockershim. That integration is gone, and Kubernetes now requires a runtime that conforms to its Container Runtime Interface (CRI, the plugin API Kubernetes uses to talk to whatever actually starts containers).[7]
Nothing about your images changed. The Kubernetes docs say that if you use Docker for building application containers, “you can still run these containers on any container runtime.”[6] The reason is a standard.
The Open Container Initiative (OCI), launched on June 22, 2015 by Docker, CoreOS, and others, defines the image and runtime formats that Docker, containerd, and CRI-O all share.[9]
From Docker-only to any runtime
How Kubernetes and Docker came to be separate
- 2014
Google open sources Kubernetes
The project starts from more than 15 years of Google's experience running production workloads.[1]
- Jun 22, 2015
The Open Container Initiative launches
Docker, CoreOS, and others put the image and runtime formats under the Linux Foundation.[9]
- Dec 2, 2020
Kubernetes announces Docker as a runtime is deprecated
The post's opening line: “You do not need to panic.”[10]
Takeaway
The split took seventeen months from warning to removal, and it only hurt people who had treated the node's runtime as Docker.
There was one real catch, and it's the kind of detail that bites on a Friday. Once a node uses containerd instead of Docker Engine, you “cannot get container information using docker ps or docker inspect,” and you can't use docker exec either.[6]
Images built or pulled by Docker on your laptop also aren't visible to the cluster. They have to be pushed to a registry first.[6]
“Images built or pulled by Docker would not be visible to container runtime and Kubernetes. They needed to be pushed to some registry.”
My take: the removal is the best evidence that the question is wrong. If Kubernetes could drop Docker Engine and your build pipeline kept working, Docker was never the thing Kubernetes depended on. The image was.
What Kubernetes asks of you in return
You hand Kubernetes a desired state and it works toward it.
The docs say you “describe a desired state in a Deployment, and the Deployment Controller changes the actual state to the desired state at a controlled rate.”[8] A Deployment is the usual object for stateless apps, and it creates a ReplicaSet that runs the copies you ask for.[8]
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80Change replicas to 3 or to 30 and the controller makes it so. Update the image and it replaces pods gradually, scaling a new ReplicaSet up while the old one scales down, and you can roll back to an earlier revision if the new one misbehaves.[8]
That is the loop Compose doesn't give you, and it's why a cluster is worth the complexity once uptime matters.
The price is real. Pods, Services, Ingress, RBAC, and storage classes are a lot of nouns for an app that fits on one server. When you do reach production, the checklist in Kubernetes in production covers what bites first.
And since every container on a node shares that node's kernel, the isolation questions in AI agent sandboxing are worth reading before you run untrusted code on one.
How I'd choose, in order
Pick the first line that describes you and stop reading the rest.
- One app on one machine, or local development. Docker and Compose. You're done.
- Learning Kubernetes. Turn on the cluster in Docker Desktop, which can run a single-node cluster (kubeadm) or a multi-node cluster (kind) for local testing.[5]
- A few services on a few servers, and a small team. Swarm mode is a legitimate answer. It ships inside Docker and has fewer moving parts.[4]
- Many services, rolling updates, autoscaling, or a cloud provider that already runs it for you. Kubernetes.
Takeaway
Use Docker to build and run containers, and add Kubernetes when you need containers to survive across more than one machine. Skipping straight to Kubernetes for a single app is the most common way to buy complexity you can't spend.
Go run docker compose up on something you own. If it never outgrows one box, you just skipped a cluster you didn't need.
Primary sources
- 1.PrimaryKubernetes documentation, "Overview". Definition, 2014 open sourcing, self-healing, rollouts, service discovery, and scaling.
- 2.PrimaryDocker documentation, "What is Docker?". Definitions of Docker, image, container, daemon, and registry.
- 3.PrimaryDocker documentation, "Docker Compose". Compose as a tool for multi-container applications from one YAML file.
- 4.PrimaryDocker documentation, "Swarm mode overview". Native cluster management, services, and declared task counts.
- 5.PrimaryDocker documentation, "Deploy on Kubernetes with Docker Desktop". Local single-node (kubeadm) and multi-node (kind) clusters.
- 6.PrimaryKubernetes documentation, "Check whether dockershim removal affects you". Docker-built images still run; images must be pushed to a registry; docker ps no longer sees containers.
- 7.PrimaryKubernetes documentation, "Container Runtimes". CRI requirement and the statement that dockershim was removed as of release 1.24.
- 8.PrimaryKubernetes documentation, "Deployments". Desired state, replicas, rolling updates, rollback, and the example manifest.
- 9.PrimaryOpen Container Initiative, "Overview". Launched June 22, 2015 by Docker, CoreOS, and others; image and runtime specifications.
- 10.PrimaryKubernetes blog, "Don't Panic: Kubernetes and Docker". December 2, 2020 deprecation announcement for Docker as a runtime after v1.20.
- 11.PrimaryKubernetes blog, "Kubernetes 1.24: Stargazer". May 3, 2022 release announcement.
- 12.PrimaryKubernetes blog, "Updated: Dockershim Removal FAQ". States that the v1.24 release removed the dockershim from Kubernetes.
Frequently asked questions
- What is the difference between Kubernetes and Docker?
- Docker builds container images and runs them as containers on a single machine, while Kubernetes manages containers across a cluster of machines. Docker answers how to package and run one application. Kubernetes answers where many copies should run, how to route traffic to them, and what to do when one fails. Most teams use both: Docker (or another builder) to make the image, Kubernetes to run it.
- Do I need Docker to use Kubernetes?
- No. Kubernetes 1.24 removed its built-in Docker Engine integration (dockershim) on May 3, 2022, and clusters now run containers through a runtime such as containerd or CRI-O. You can still build images with Docker, push them to a registry, and run them on Kubernetes, because Docker produces standard Open Container Initiative images.
- Is Docker Swarm the same as Kubernetes?
- No, but they solve the same problem. Docker Swarm mode is the cluster manager built into Docker Engine, and Kubernetes is a separate open source platform from Google that Google open sourced in 2014. Both let you declare how many copies of a service to run and replace failed ones. Kubernetes has the larger feature set and ecosystem, and Swarm is simpler to start with because it ships inside Docker.
- Is Docker Compose a replacement for Kubernetes?
- For a single machine, often yes. Docker Compose defines and runs multi-container applications from one YAML file, which covers most local development and many small deployments. It does not schedule containers across multiple hosts or roll out updates gradually, so once you need more than one server, Kubernetes becomes the better fit.
- Can I run Kubernetes on my laptop with Docker?
- Yes. Docker Desktop includes a Kubernetes cluster you turn on from the Kubernetes view of its dashboard, and it can run as a single-node cluster provisioned with kubeadm or a multi-node cluster provisioned with kind. It is meant for local development and testing, not production.
Written by
Tech Talk News Editorial
Computer engineering background. Writes about software, AI, markets, and real estate, and the places where the three meet.
More about the author