Answer the question
In order to leave comments, you need to log in
How to remove unwanted images from local Docker registry?
I have an application that is periodically updated and then deployed to multiple servers. The application is packaged in Docker. With each update of the application, Jenkins completely removes the old image and builds a new one.
So that on each of the servers you can simply download the image and run it (and not rebuild it), I deployed my own Docker Registry ( https://docs.docker.com/registry ) and upload the image there after rebuilding.
But, one thing is not clear. How can I remove the old image from this registry before uploading the new one?
If I just push with the same name, then the amount of space taken on the server where the registry is spinning increases by gigabytes. I absolutely do not need to litter the server with the storage of some old layers / images. I just need to keep an up-to-date image that I can download and deploy at any time.
I did not find a clear answer in the documentation. There is of course the Registry API
( https://docs.docker.com/registry/spec/api ) which has methods similar to delete. I tried to call them (with a subsequent call to garbage-collect on the registry container), but it's not clear what they do at all, since after calling them, the amount of occupied space does not decrease at all.
Answer the question
In order to leave comments, you need to log in
There is no regular solution, I create a new registry, transfer what I need and delete the old one.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question