How to get all docker image layers in k8s masternode

I'm a beginner at Kubernetes and Docker.

I want to receive the image layer of all the containers that are operating on the master node of k8s. (If there is any way, it may be a layer of one container.)

The way I thought about it so far is

  1. Enter the container through the kubectl exec -it command and receive the image layer But I failed because I didn't know if there was information of the image layer in the container.

  2. Access the worker node from the master node and filter out only the image layer through the docker inspect command But I couldn't find a way to get the worker node to execute the command. Also, I could not find a way to access the worker node.

Here is my development environment:

screenshot of VMs

I created three virtual machines from vm vitualbox, one master node and two worker nodes, and the OS is Ubuntu 20.04.

The final goal is to obtain an image layer of all running containers.

Anyway, it is okay to have one container, so I want to have the image layer output from the terminal running the master node or the information including the image layer (information from the docker inspect command) output.

My apologies for any phrasing, this was posted using a translator.


  • Don't know exactly if you actually mean "layer" or "image name or ID", however, this command will output you the name of the pods, their image name and their docker pullable ID:

    kubectl get pods  -o=custom-columns=NAME:"",IMAGE:".spec.containers[*].image",IMAGE_ID:".status.containerStatuses[*].

    (If this doesnt work well for you, You can check here for more examples: Get the image and SHA image ID of images in pod on Kubernetes deployment)

    Since there is no way to inspect images layers in kubernetes directly, once you have pulled this images, you can check their layers with docker binary:

    docker history IMAGE_NAME:IMAGE_TAG

    (cf here

    UPDATE: or you can juste use kubectl get pod -o wide to get the images of the current running pods