Docker vs Kubernetes
A tool for building and running containers versus a system for orchestrating them across a cluster.
Overview
Docker and Kubernetes are often mentioned together but operate at different levels. Docker packages an application and its dependencies into a container image and runs that image as an isolated process on one machine. Kubernetes schedules and supervises many containers across a cluster of machines, restarting failed ones and scaling them with demand.
They are complements rather than competitors. A typical workflow builds an image with Docker or a compatible builder, pushes it to a registry, and describes how to run it in a Kubernetes manifest.
Side-by-side comparison
| Docker | Kubernetes | |
|---|---|---|
| Scope | Builds and runs containers on a host | Orchestrates containers across a cluster |
| Origin | dotCloud, 2013 | Google, 2014 |
| Basic unit | Container | Pod (one or more containers) |
| Scaling | Single host; Docker Swarm for simple clusters | Built-in horizontal scaling and self-healing |
| Networking | Bridge and host networks per machine | Cluster-wide Services and Ingress |
| Configuration | Dockerfile and Compose files | Declarative YAML manifests |
| Written in | Go | Go |
Choosing between them
A single server or a small project is usually well served by Docker or Docker Compose alone. Kubernetes starts to pay off when an application is split into many services, needs rolling updates, automatic recovery or running across several machines, accepting extra operational complexity in return.
Kubernetes does not require Docker itself: it runs any container runtime that implements its Container Runtime Interface, and images built with Docker run unchanged.
Read more
- Docker: A platform for building, distributing and running applications in containers.
- Kubernetes: An open-source system for automating deployment, scaling and management of containerised applications.