Docker compose v/s Kubernetes

Docker compose and Kubernetes looks very similar when we are starting out. This usually begs the question, why have one when the other already exists?

Have you ever wondered why we need Kubernetes when docker compose can be used to spin up multiple applications using a simple YAML?

If yes, then this blog is for you.

To begin with, let’s understand some basic concepts

  1. Container: Container is a running version of multiple apps / binaries packaged together.
  2. Docker: Docker is a tool to run containers seamlessly on any host environment. It provides virtualization and gets rid of the “It runs on my system problem

Now, let’s draw comparison between docker compose and kubernetes

Docker ComposeKubernetes
It is used to run containers on a single hostKubernetes can run containers on multiple different hosts. This is the single most important difference between these two
Docker compose does not have the concept of pod and can spin up only containersKubernetes creates pods which is a collection of containers that are packaged and run together
The number of containers cannot be autoscaled to meet increased demandThe number of pods can be autoscaled to meet the increased demand
Self heal mechanism is not available in docker compose. If a container fails, there is no way to restart itKubernetes supports self healing pods with the help of resources like deployments and replicasets