Search code examples
dockergarbage-collectiondocker-registry

How to use GC in Docker Registry without accessing container


I want to use the garbage collection of the docker registry without going inside my container. Is there a way to use the API to perform the GC? My main goal is to run the GC from a script on another server.


Solution

  • "Running garbage collection" does not involve any remote/REST API
    (although this is debated on issue 1515).

    bin/registry garbage-collect [--dry-run] /path/to/config.yml
    

    So you would need to add to your registry container a listener in order for you to call that remote url, and for that listener to trigger internally the gc.