Kubernetes - Docker layer across pods

6/27/2018

Most of my images that i deploy into kubernets has the common base(From) image. So, I have multiple applications deployed into multiple pods. I am trying to understand How the docker layer cache works across multiple pods as the From image is same for all the pods?

Thanks

-- user1578872
docker
kubernetes

1 Answer

6/27/2018

See "How Pods manage multiple Containers"

Pods are designed to support multiple cooperating processes (as containers) that form a cohesive unit of service.
The containers in a Pod are automatically co-located and co-scheduled on the same physical or virtual machine in the cluster.
The containers can share resources and dependencies, communicate with one another, and coordinate when and how they are terminated.

So, within the same cluster, your pods will share the same container runtime (for instance docker, but others exist).
Which means the layers of your base image will be reused by the various containers running in those pods.
Then each container will write to its special UnionFS (which can use one of a few different storage backends, such as aufs or btrfs, there are several choices), using copy-on-write.

-- VonC
Source: StackOverflow