Delete Docker images from a certain vendor

Using Renovate to update your dependencies is a great way of automating upgrades. However, using the Docker image can quickly fill up your CI server or machine.

With their rapid release schedule, a day can see several new versions appearing. We have Renovate running every 2 hours which, as Renovate updates itself, could see 6 new Docker images downloaded a day (Renovate make the version upgrade one run and then merges it the next).

As we have NPM, Composer, Docker and Gitlab CI dependencies updated by Renovate, we find outselves using the -full image which, uncompressed, is over 6GB.

Becuase of that, we now have the following command running weekly:

docker rmi `docker image ls | egrep "^renovate/" | awk '{print$3}'`

This finds all the images that start with renovate and deletes them. When Renovate next runs, it will pull down the image it needs.

View this post on Github

You might also enjoy…

Mike Street

Written by Mike Street

Mike is a CTO and Lead Developer from Brighton, UK. He spends his time writing, cycling and coding. You can find Mike on Mastodon.