Cleaning up docker registry

Hello!
My company is forced to use artifactory for a lot of ci jobs and now the gitlab docker registry is obsolete. I’ve got the task to clean up the space (about 500g) and now I dont know how to do this “right”. We have over 1k projects so I just cant go into each one and clean it up one by one.
Would it do harm if I just delete the files on the server?

thanks!
Daniel

Some doc on container registry and Gitlab API: GitLab Container Registry | GitLab

I have in the past used the API to list ALL of the projects on the server:

This will dump the header and the number of pages that git will produce:
curl --head “https://git.MYDOMAIN.com/api/v4/projects?private_token=TOKEN&per_page=100

→ 6 Pages → X-Total-Pages: 6

Then dump each of the pages, one at a time:
2036 curl “https://git.MYDOMAIN.com/api/v4/projects?private_token=TOKEN&per_page=100&page=1” >> Projectlist.json
2037 curl “https://git.MYDOMAIN.com/api/v4/projects?private_token=TOKEN&per_page=100&page=2” >> Projectlist.json
2038 curl “https://git.MYDOMAIN.com/api/v4/projects?private_token=TOKEN&per_page=100&page=3” >> Projectlist.json
2039 curl “https://git.MYDOMAIN.com/api/v4/projects?private_token=TOKEN&per_page=100&page=4” >> Projectlist.json
2040 curl “https://git.MYDOMAIN.com/api/v4/projects?private_token=TOKEN&per_page=100&page=5” >> Projectlist.json
2041 curl “https://git.MYDOMAIN.com/api/v4/projects?private_token=TOKEN&per_page=100&page=6” >> Projectlist.json

distill that down to the URL’s for each project
jq . Projectlist.json | grep http_url_to_repo > ProjectListFromAPI.txt

Use VS code find - replace and column select to clean up to:
Just the project names.

Then feed that to something like: