Cleanup old Deis builds Original source is https://github.com/dreipol/cleanup-deis-images
1.2K
If you release often your build server will collect a large amount of images that are no longer used. This script keeps your Deis cluster slick by removing app versions that are older than n releases.
You need to mount the docker socket into the container in order for the script to access and cleanup the images.
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock quipper/cleanup-deis-images
You can specify how many versions should be kept (4 per default) by setting
the KEEP_LAST_VERSIONS env var.
docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-e KEEP_LAST_VERSIONS=3 quipper/cleanup-deis-images
If you have images from v2 up to v6 the script will remove all images
older than v6 - n. With the default of 4 this will
only remove the image 10.21.2.170:5000/zermatt-microsite:v2
10.21.2.170:5000/zermatt-microsite:v6
10.21.2.170:5000/zermatt-microsite:v5
10.21.2.170:5000/zermatt-microsite:v4
10.21.2.170:5000/zermatt-microsite:v3
10.21.2.170:5000/zermatt-microsite:v2
You can use the cleanup-images.service file together with the cleanup-iamges.timer unit
to regularly schedule a cleanup of your machines via fleet.
fleetctl start cleanup-images
fleetctl start cleanup-images.timer
Content type
Image
Digest
Size
31.6 MB
Last updated
over 10 years ago
docker pull quipper/cleanup-deis-images