Docker Image Cleanup
At Wongnai, we build image from our CI tool. The
images are tagged with build number before pushing so we can track the running
version in the image field of Kubernetes.
However, this result in a lot of leftover images stored in the builder Docker
and so this project was born.
Suppose you have the following images:
- test:5 test:latest
and you execute
sudo docker run -v /var/run/docker.sock:/var/run/docker.sock --rm willwill/imagecleanup \ --numbered test --numbered-keep 2
This will remove all images but
- test:5 test:latest (Images with multiple tags do not count)
Images within other repository are unaffected.