-
-
Save mortensteenrasmussen/512f0566dbc3ef1cc4a2c47dd9cdb973 to your computer and use it in GitHub Desktop.
Thank you very many!
Thank you @mortensteenrasmussen for a very useful script. Especially line#10 is a strong piece of shell-engineering!
How should "curl -s -X ..." work without an access token? I had to get the token for every single repository and pass it to the curl command to get it work.
This was awesome. Just a note that:
As the curl command is silent, in my case at least, the docker registry storage delete option was set to false, so the script wasn't able to delete anything.
You might want to write those logs to somewhere like /var/log/cleanupScript.log to make sure you are cleaning what you mean.
Works perfectly. Thank you so much :)
@mortensteenrasmussen, thank you very much for this script.
Seven years later, there are still people like me, with the same problem, running terribly outdated docker registry version.
If there weren't for this script, I would have to devise the solution myself, which would take many hours, if not days.
The procedure in the script is correct but the script can be optimized in order to work much, much faster (in my setup more than 100 times faster).
Here is a fork with a modified script I wrote based on your solution:
https://gist.github.com/djosip/1c65c95d9a84acf696851451814529dd
Thank you @mortensteenrasmussen for a very useful script. Especially line#10 is a strong piece of shell-engineering!
I couldn't hold myself and had to react to the "Especially line#10 is a strong piece of shell-engineering".
The original script does work and will do the job but the line#10 is far from a good example of shell engineering.
I am sure the author had in mind to quickly solve the problem and not chasing the perfection and that's ok.
However, the original script, in my environment with 2881 manifest to delete, took around 12.53 hours.
After the rewrite, optimized script took only 4.48 minutes in the same environment with 2881 manifest to delete.
I did the correct benchmark using backup and restore just to make sure I got it right the first time.
Here is the optimized script with added error handling (the script was tested only in the GNU environment):
https://gist.github.com/djosip/1c65c95d9a84acf696851451814529dd
Thanks! Have been looking for months how to stop the registry from leaking disk space. Good job!