From https://docs.docker.com/registry/garbage-collection/#how-garbage-collection-works, the way to run a garbage collection is to execute this within the container:
bin/registry garbage-collect [--dry-run] /path/to/config.yml
Where the config.yml has to be of the form:
version: 0.1
storage:
filesystem:
rootdirectory: /registry/data
However, when shipped as a docker container, this root directory is well defined (/var/lib/registry). Is it possible then to add this configuration to the base container so that I dont have to mount this config in or rebuild the container and add the config myself.
In the end, my goal is to be able to just pull the docker registry and create a cron job that will run:
docker exec registry bin/registry garbage-collect /gcconfig/config.yml
The config inside the registry container is located at /etc/docker/registry/config.yml.
my bad. Discovered this after some more digging around.
This should be the default example in the docs...
Most helpful comment
The config inside the registry container is located at
/etc/docker/registry/config.yml.