Docker Community Forums

Share and learn in the Docker community.

Test for existence of repository


(Glasgow) #1

Is there any way via the API to test for the existence of a repository, aside from pulling the entire /v2/_catalog and checking through the whole list?

I tried things like GET /v2/namespace/repo/tags/list but I always get 401 instead of 404 (using token auth), which is not good enough because in this situation I need to distinguish between “I don’t have access” and “the repo doesn’t exist”. (Assume this is an administrative type user that should be able to get this information no matter what.)

It seems like what is needed is something like GET /v2/exists/namespace/repo where /v2/exists would have the “registry:catalog:*” scope just like /v2/_catalog, since if I’m allowed to view the entire catalog I should also be allowed to confirm one element in the catalog exists (or not). Am I missing something though? Is there another way to do this already?