Home > Mobile >  IS there any Kubernetes API/kubectl command to delete older docker image?
IS there any Kubernetes API/kubectl command to delete older docker image?

Time:05-27

Is there any kubernetes api or kubectl command to delete older docker images that is lying on the device.

I know we can delete by using docker rm image but i want to do remotely through API.

Any alternative?

CodePudding user response:

The kubelet removes unused images automatically when the docker disk fullness reaches a configurable threshold.

See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#containers-images for details on how that works.

There is no API-lead way of forcefully delete an image.

If you really need to manually clean up an image from nodes, you could run a container that connects to the docker daemon and runs docker rmi <image> there, but it smells like an antipattern to me.

CodePudding user response:

There is no kubernetes api or kubectl command to delete older docker images.

You should be using

docker rmi <image> 
or 
docker system prune 

commands to remove unwanted images.

  • Related