Where the images get stored in Azure Kubernetes Cluster after pulling from Azure Container Registry?

3/7/2019

I am using Kubernetes to deploy all my microservices provided by Azure Kubernetes Services.

Whenever I release an update of my microservice which is getting frequently from last one month, it pulls the new image from the Azure Container Registry.

I was trying to figure out where do these images reside in the cluster?

Just like Docker stores, the pulled images in /var/lib/docker & since the Kubernetes uses Docker under the hood may be it stores the images somewhere too.

But if this is the case, how can I delete the old images from the cluster that are not in use anymore?

-- mkb_mc
azure
azure-kubernetes
docker
image
kubernetes

2 Answers

3/15/2019

I was trying to figure out where do these images reside in the cluster?

With the test and check, the result shows each node in the AKS cluster installed the Docker server, and the images stored like Docker as you say that the image layers stored in the directory /var/lib/docker/.

how can I delete the old images from the cluster that are not in use anymore?

You can do this through the Docker command inside the node. Follow the steps in Connect with SSH to Azure Kubernetes Service (AKS) cluster nodes to make a connection to the node, then you could delete the image through the Docker CLI docker rmi image_name:tag, but carefully with it, make sure the image is really no more useful.

-- Charles Xu
Source: StackOverflow

3/7/2019

You are correct in guessing that it's mostly up to Docker, or rather to whatever the active CRI plugin is. The Kubelet automatically cleans up old images when disk space runs low so it's rare that you need to ever touch it directly, but if you did (and are using Docker as your runtime) then it would be the same docker image commands as per normal.

-- coderanger
Source: StackOverflow