1

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?

2 Answers2

1

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 to 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.

whites11
  • 12,008
  • 3
  • 36
  • 53
0

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.

P Ekambaram
  • 15,499
  • 7
  • 34
  • 59