From 70b160ae032b548b3d4456f17f8436b24ea37a15 Mon Sep 17 00:00:00 2001 From: Urvashi Mohnani Date: Tue, 11 Sep 2018 16:37:43 -0400 Subject: Search registries with an empty query Adds functionality to search registries implementing the v2 endpoint with an empty query, that is the results will be all the available images on the registries. If this is tried with a v1 registry an error will occur. To search a whole registry, there needs to be a trailing slash at the end, i.e `podman search registry.fedoraproject.org/`. Signed-off-by: Urvashi Mohnani Closes: #1444 Approved by: rhatdan --- cmd/podman/search.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cmd') diff --git a/cmd/podman/search.go b/cmd/podman/search.go index 009ff8ba9..f64b822fc 100644 --- a/cmd/podman/search.go +++ b/cmd/podman/search.go @@ -345,6 +345,11 @@ func matchesOfficialFilter(filter searchFilterParams, result docker.SearchResult } func getRegistry(image string) (string, error) { + // It is possible to only have the registry name in the format "myregistry/" + // if so, just trim the "/" from the end and return the registry name + if strings.HasSuffix(image, "/") { + return strings.TrimSuffix(image, "/"), nil + } imgRef, err := reference.Parse(image) if err != nil { return "", err -- cgit v1.2.3-54-g00ecf