The library provides a registry-cleaner CLI script to cleanup a Docker registry.

usage: registry-cleaner [-h] [-d] [-n] [-r [REPOS ...]] host

A tool to clean old images of a Docker registry.

positional arguments:
  host                  the Docker registry host

optional arguments:
  -h, --help            show this help message and exit
  -d, --debug           enable debug logging
  -n, --dry-run         do not delete anything
  -r [REPOS ...], --repos [REPOS ...]
                        the name of a repository


Please also read the regarding the garbage collection.