Tutai Kumar Dalal
Tutai Kumar Dalal

Reputation: 114

Delete old docker images from all kubernetes Node

Kubernetes Garbage Collection have a option to delete the images when it reached to a certain percentage of disk usages Link

Is there any way to delete all docker images which is more than three days old and not being used now instead of doing it manually ?

Upvotes: 0

Views: 3190

Answers (2)

P Ekambaram
P Ekambaram

Reputation: 17689

Follow the below steps

  1. Create a shell script to run docker system prune -f.
  2. Build a docker image using the shell script from above
  3. Deploy a cronjob to clean up daily or twice in a day

Upvotes: 1

Markoorn
Markoorn

Reputation: 2565

You could also simply connect to the node in question and run docker system prune -f there directly.

Upvotes: 1

Related Questions