Reducing diskusage (for container registry?)

We have around 158 GiB in /var/opt/gitlab/gitlab-rails/shared/registry/docker/registry/v2/blobs, that seems like rather much (especially if I’m right in how useless most of that is)

As far as I have found out, that is docker images from old builds, if that’s true, they’re not needed. (New builds can be made)

We have quite a few projects (currently around 2900), and I have no involvement in most of them, so I would really really prefer not having to visit each of them in them web interface to do anything, but I don’t mind using being the big bad admin that breaks the possibility to do something to old builds.

The only documentation I’ve found on this is:
https://docs.gitlab.com/omnibus/maintenance/#container-registry-garbage-collection

But gitlab-ctl registry-garbage-collect didn’t delete much but instead gave a lot of:

<group>/<project>/26-09-release: marking blob sha256:6e83b260b73b908ebabde46b72fc5790bf4f029b53acbbfe35da8ff8fba795ac
<group>/<project>/26-09-release: marking blob sha256:e26b65fd1143ee4f9b7b6b958aeafdb996172d10b723f0bba24335a8f7ae692c

several hundred for some projects. How do I get rid of (most of) those?

Have you seen this documentation for deleting in bulk? https://docs.gitlab.com/ce/api/container_registry.html#delete-repository-tags-in-bulk

Would this work for you?

Yes, I had seen that.

No, it doesn’t help. Once again it’s a feature aimed at developers, not those of us who have to administrate a GitLab server.

There are two problems with it:

  1. It’s per project - i.e. it’s painful to use when I want to clean all projects.
  2. It doesn’t directly help me freeing disk space, because it only removes tags so the garbage collection will free some space. (at least that’s how the other delete command works, I haven’t actually tried the bulk deletion, it doesn’t give much when you already have to loop over projects)

Once again (I’ve found many) a sign that GitLab favours usability for developers over maintainability for those of us who has to keep it running.

I’m now in the same situation as a big bad admin.
Did you resolved your grief with the container registery?

I didn’t resolve it in the sense that I found a useable feature in GitLab. But I did get to a state we can live with by writing a 119 line (so not completely trivial) Perl-script to run from a systemd timer. It was written on company time, so it’s probably owned by the company I work for, so I can’t just give out copies.

well


(not that bad but :wink: )

Then further looking
chances are that I 'll just run gitlab-ctl registry-garbage-collect -m and I might get hated :man_shrugging: