ETOOBUSY 🚀 minimal blogging for the impatient
Tired of deleting several tags for the same Docker image?
When generating images with dibs, I usually set several alias tags to
keep track of different aspects. As an example, I usually generate both a
versioned tag and
latest, in addition to a date-related tag to keep track
of this info too. We might go on futher, of course.
When doing some cleaning, though, I have to go through all these aliases and remove them one by one. Or have I?
I was about to write the typical ad-hoc script when I realized that… I already had done this in the past!
Remove hanging images
Sometimes images are kicked out because new ones take their tags. In this
case, they usually end up with name
<none>, which makes them a bit
difficult to get rid of (hint: use the image id). When you call the script
without any parameter, it will get rid of those stale, hanging images:
Remove all tags associated to an image
The other use case where
dockermi can prove useful is to get rid of all
variants of a specific image name. As an example, suppose that you have
several tags associated to image
foo/barbazius:latest foo/barbazius:1.0 foo/barbazius:1.0.3 foo/barbazius:20200306-102030-1234
To get rid of all of them in one single sweep you would call:
$ dockermi foo/barbazius
I think it’s fair to close this post here… have fun!