Garbage-collection on private registry (native, not running in docker)

Hi, we’re running a private docker registry on Ubuntu, basically followed this setup:

root@dockerhub:/# docker -v
Docker version 27.5.1, build 9f9e405
docker-buildx-plugin/noble,now 0.20.0-1~ubuntu.24.04~noble amd64 [installed,upgradable to: 0.21.0-1~ubuntu.24.04~noble]
docker-ce-cli/noble,now 5:27.5.1-1~ubuntu.24.04~noble amd64 [installed,upgradable to: 5:28.0.0-1~ubuntu.24.04~noble]
docker-ce-rootless-extras/noble,now 5:27.5.1-1~ubuntu.24.04~noble amd64 [installed,upgradable to: 5:28.0.0-1~ubuntu.24.04~noble]
docker-ce/noble,now 5:27.5.1-1~ubuntu.24.04~noble amd64 [installed,upgradable to: 5:28.0.0-1~ubuntu.24.04~noble]
docker-compose-plugin/noble,now 2.32.4-1~ubuntu.24.04~noble amd64 [installed,upgradable to: 2.33.0-1~ubuntu.24.04~noble]
docker-registry/noble-updates,noble-security,now 2.8.2+ds1-1ubuntu0.24.04.2 amd64 [installed]

I’m looking to manually run garbage collection, per docs:

"As of v2.4.0 a garbage collector command is included within the registry binary. "
Garbage collection can be run as follows
bin/registry garbage-collect [--dry-run] /path/to/config.yml

System-wide, I cannot find a binary file that is “registry”:

/etc/docker/registry# find / -name registry
/etc/docker/registry  (this is a folder)
/usr/share/vim/registry
/var/lib/docker-registry/docker/registry
/var/lib/ucf/registry

I can see how it gets run when the docker registry is installed under docker:
docker exec registry bin/registry garbage-collect --dry-run /etc/docker/registry/config.yml

But as I’m not running the registry under docker, I’m expecting a binary file here…

I’m missing something simple…

It looks like the native binary is docker-compose, which does not have garbage collection built in and I need to use: docker system prune instead?

Docker-compose in the Docker registry host machine to set up and start up the components for your Docker registry

That package is maintained by Ubuntu and I never tried it. I didn’t even know it existed.

apt info docker-registry | grep Maintainer
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian Go Packaging Team <team+pkg-go@tracker.debian.org>

If you want to make sure you have the most features, you can use distributions like Harbor.

The package maintainers could name it differently. In general, you can get more info about a package using apt-file like this

sudo apt install apt-file
sudo apt-file update
apt-file list docker-registry

Now you can see where the regisry binary is named as “docker-registry”

docker-registry: /etc/docker/registry/config.yml
docker-registry: /etc/init.d/docker-registry
docker-registry: /lib/systemd/system/docker-registry.service
docker-registry: /usr/bin/docker-registry
docker-registry: /usr/lib/systemd/system/docker-registry.service
docker-registry: /usr/share/doc/docker-registry/NEWS.Debian.gz
docker-registry: /usr/share/doc/docker-registry/README.md.gz
docker-registry: /usr/share/doc/docker-registry/architecture.md
docker-registry: /usr/share/doc/docker-registry/changelog.Debian.gz
docker-registry: /usr/share/doc/docker-registry/configuration.md.gz
docker-registry: /usr/share/doc/docker-registry/copyright
docker-registry: /usr/share/doc/docker-registry/spec/api.md.gz
docker-registry: /usr/share/doc/docker-registry/spec/api.md.tmpl.gz
docker-registry: /usr/share/doc/docker-registry/spec/auth/index.md
docker-registry: /usr/share/doc/docker-registry/spec/auth/jwt.md.gz
docker-registry: /usr/share/doc/docker-registry/spec/auth/oauth.md.gz
docker-registry: /usr/share/doc/docker-registry/spec/auth/scope.md.gz
docker-registry: /usr/share/doc/docker-registry/spec/auth/token.md.gz
docker-registry: /usr/share/doc/docker-registry/spec/deprecated-schema-v1.md
docker-registry: /usr/share/doc/docker-registry/spec/images/v2-registry-auth.png
docker-registry: /usr/share/doc/docker-registry/spec/implementations.md
docker-registry: /usr/share/doc/docker-registry/spec/index.md
docker-registry: /usr/share/doc/docker-registry/spec/json.md
docker-registry: /usr/share/doc/docker-registry/spec/manifest-v2-1.md.gz
docker-registry: /usr/share/doc/docker-registry/spec/manifest-v2-2.md.gz
docker-registry: /usr/share/doc/docker-registry/spec/menu.md

How did you came to this conclusion? How is Docker Compose related to the registry when you are not even running the registry in a container?

And how did we switched from the registrí issue to garbage collection? :slight_smile:

Docker Compose is a kind of client. It will not do garbage collection. It is for starting and managing containers.

@rimelek, many thanks. Got it. Yes, I was confused about non-container registry use. Thank you for pointing out the binary.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.