brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: curl /v2/_catalog lists the repositories in a self-hosted Docker registry

Docker
~/tips/tip-registry-v2-catalog-list-repositories

curl http://localhost:5000/v2/_catalog

Asks a registry over its HTTP API which repositories it holds.

If you run your own registry, you don’t need a tool to see what is in it. The registry speaks plain HTTP, and one curl call lists the repositories.

curl http://localhost:5000/v2/_catalog

The answer is JSON with a repositories key that holds the names. Use https and your host name when the registry has TLS, and add -u user:password when it asks for a login.

For a big registry, ask for a page at a time with the n parameter:

curl -i "http://localhost:5000/v2/_catalog?n=50"

The results are sorted, and when there is more, the response has a Link header with the URL of the next block. Keep following it until the header is gone. I’d use -i here so the header is visible.

The caveat comes from the API spec. What the catalog returns depends on the registry. Some give the full list, others limit it to what your account may see, or cap the results even when you didn’t ask for pages. So a name that is missing from the list doesn’t prove the repository doesn’t exist. And the catalog gives repository names only. For the tags of one repository, the same API has /v2/<name>/tags/list.

Further reading: Distribution registry HTTP API

More Docker tips ONBUILD RUN /usr/local/bin/python-build --dir /app/src SHELL ["/bin/bash", "-c"] docker commit <container> myname/testimage:version3 docker import /path/to/exampleimage.tgz docker compose events All Docker tips (192) All topics

Link