Skip to content

Add Container Registry garbage-collect command

Following discussion from this thread it seems like this is quite important maintenance action (Delete container layers from filesystem): #1375 (closed)

Docker Distribution (2.4.1) that we use allows us to execute garbage-collect method to remove orphaned layers from filesystem.

This can be achieved with manual action from the server:

/opt/gitlab/embedded/bin/registry garbage-collect /var/opt/gitlab/registry/config.yml

It would be handy to have alias for this command:

gitlab-ctl container-registry-garbage-collect

Since that current garbage-collect is a stop-the-world GC we need to either stop registry or put that into maintenance mode (read-only).

Read-only mode can be achieved with adding this to registry configuration:

storage:
  maintenance:
    readonly:
      enabled: false