View the contents of a Docker Registry v2
Docker image available at ghcr.io/ricardobranco777/regview:latest
regview [OPTIONS] REGISTRY[/REPOSITORY[:TAG|@DIGEST]]
-a, --all Print information for all architecture
--arch strings Target architecture. May be specified multiple times
--debug Enable debug
--delete Delete images. USE WITH CAUTION
--digests Show digests
--dry-run Used with --delete: only show the images that would be deleted
-f, --format string Output format
--insecure Allow insecure server connections
--no-trunc Don't truncate output
--os strings Target OS. May be specified multiple times
-p, --pass string Password for authentication
--raw Raw values for date and size
-C, --tlscacert string Trust certs signed only by this CA
-c, --tlscert string Path to TLS certificate file
-k, --tlskey string Path to TLS key file
-P, --tlskeypass string Passphrase for TLS key file
-u, --user string Username for authentication
-v, --verbose Show more information
--version Show version and exit
Valid options for --arch: 386 amd64 arm arm64 mips mips64 mips64le mipsle ppc64 ppc64le riscv64 s390x wasm
Valid options for --os: aix android darwin dragonfly freebsd illumos ios js linux netbsd openbsd plan9 solaris windows
- Shell pattern matching is supported in repositories and tags like
busybo?/late*
ordebian:[7-9]
- HTTP Basic Authentication
- Token Authentication
- Docker Distribution
- Amazon ECR (get credentials with
aws ecr get-login
and rundocker login
) - Azure ACR (get credentials with
az acr credential show -n $
and rundocker login
) - Google GCR (run
gcloud auth configure-docker
and use[ZONE.]gcr.io/<PROJECT>/*
to list the registry)
To delete tagged images you can use the --delete
option. Use the --dry-run
option is you want to view the images that would be deleted.
Steps:
- Make sure that the registry container has the
REGISTRY_STORAGE_DELETE_ENABLED
environment variable (or the relevant entry in/etc/docker/registry/config.yml
) set totrue
. - Run
regview --delete ...
- Either stop or restart the registry cointainer in maintenance mode by setting the
REGISTRY_STORAGE_MAINTENANCE_READONLY
environment variable totrue
(or editing the relevant entry in/etc/docker/registry/config.yml
). - Run
docker run --rm --volumes-from $CONTAINER registry:2 garbage-collect /etc/docker/registry/config.yml
if the container was stopped. Otherwisedocker exec $CONTAINER garbage-collect /etc/docker/registry/config.yml
if the container is in maintenance mode. - Optionally run the same command from above appending
--delete-untagged
to delete untagged images. - Restart the registry container in production mode.
NOTES:
- The
--delete-untagged
option was added to Docker Registry 2.7.0 - The
--delete-untagged
option is BUGGY with multi-arch images. The only workaround is to push those images adding the os/arch name to the image name. - USE AT YOUR OWN RISK!
- Listing a pull through cache Registry may pollute the cache with unwanted images as the cache proxies requests, ending up with
TOOMANYREQUESTS error: "You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit".
- When developing this tool I was warned that I was DDOS'ing the production registry, so be careful when tweaking the code that uses goroutines.