Sign inSign up

willwill/imagecleanup

By willwill

Updated about 10 years ago

Cleanup unused Docker images

Image
0

390

willwill/imagecleanup repository overview

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.

Usage

Suppose you have the following images:

  • test:1
  • test:2
  • test:3
  • test:4
  • 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:3
  • test:4
  • test:5 test:latest (Images with multiple tags do not count)

Images within other repository are unaffected.

Tag summary

Content type

Image

Digest

Size

49.7 MB

Last updated

about 10 years ago

docker pull willwill/imagecleanup