How do Kubernetes and Docker work together?

Ashis Sharma
2 min readJan 2, 2023

--

The Context

We build docker images in the cloud or in locally using docker and then we use those containers in the Kubernetes cluster. So the question is how these two work with each other because these two tools are from two different companies.

In order for us to understand this first we need to know the following things.

  1. Open Container Initiative (OCI)
  2. Container Runtime

Open Container Initiative

It is a Linux Foundation Project started by Docker on June 2015 to standardize operating system-level virtualization for containers. It means in order for anyone to build containers they have to follow certain standards. The OCI currently contains three specifications: the Runtime Specification (runtime-spec), the Image Specification (image-spec) and the Distribution Specification (distribution-spec). The Runtime specs define how to run a “filesystem bundle”. Image specs define the archive format of OCI container images, which consists of a manifest. The Distribution specs define an API protocol to facilitate and standardize the distribution of content.

Container Runtime

It’s software that runs and manages components required to run containers. For e.g. when we issue “docker run” it makes a request to container runtime and runs the container. It manages the container’s lifecycle.

So finally how exactly do Kubernetes and Docker work together?

When we build docker images using docker it follows OCI standards to build images so that any container runtime can run the images. In Kubernetes, each Worker Node has a container runtime installed so that the Nodes can run containers.

I hope this was helpful information. Please feel free to connect with me on LinkedIn or visit my website.

Cheers

--

--