I know that this can be done with dockerhub
. I want to know if there is something similar available for gitlab registry.
The use case is that, I have written a fabric script to revert a deployment to a particular tag provided by the user. Before actually pulling in the images, I want to know whether an image with the specified tag exists in the registry and warn the user accordingly.
I've searched in their documentation, but couldn't find anything.
Note: User here is the person who is deploying the code.
Unless the GitLab Container Registry supports the kind of curl dockerhub does (with v1/repositories/$1/tags/$2
), I doubt it offers that feature.
(See GitLab 16.7, Dec. 2023, at the end)
For instance, issue 26866 "GitLab Registry available images list/search" is still open after 10 months.
Update for GitLab 12.2 (April 2019, 18 months later)
After working through the implementation, it made sense to create two endpoints:
GET /groups/:id/registry/repositories
- Returns a list of all Docker container repositories for all projects within the group, similar toGET /projects/:id/registry/repositories
and
GET /groups/:id/registry/repositories/tags
- Returns a list of all Docker container repositories for all projects within the group including all tags for each container repository. The response will look something like this:
So that could help checking if an image:tag
exists.
Update GitLab 13.0 (May 2020)
Use search to quickly find and discover images hosted in the GitLab Container Registry
When you or someone on your team publishes an image to the GitLab Container Registry, you need a way to quickly find it and ensure the image was built properly.
If you’re using GitLab CI/CD to publish images with each build, it’s been very difficult to find an image efficiently within the current user interface. Instead, you’ve relied on the command line or the API.We are excited to announce that in 13.0, we’ve added search functionality to the GitLab Container Registry.
Simply navigate to your project or group’s registry and enter an image name to see a list of all your images.
See documentation and issue.
See also GitLab 14.7 (January 2022)
Sort Docker tags in the Container Registry browser
You can now sort the list of tags in the Container Registry tag details page by name.
Previously, there was no sort functionality. This sometimes required you to scroll through many pages to find a specific tag.
By default, the tags list is now sorted by name in ascending order. You may also change the sort order to descending.
See this issue to track any further work on tag sorting.See Documentation and Issue.
GitLab 16.7 (December 2023) adds:
List repository tags with new Container Registry API
Previously, the Container Registry relied on the Docker/OCI listing image tags registry API to list and display tags in GitLab. This API had significant performance and discoverability limitations.
This API performed slowly because the number of network requests against the registry scaled with the number of tags in the tags list. In addition, because the API didn’t track publish time, the published timestamp was often incorrect. There were also limitations when displaying images based on Docker manifest lists or OCI indexes, such as for multi-architecture images.
To address these limitations, we introduced a new registry list repository tags API. By updating the user interface to use the new API, the number of requests to the Container Registry is reduced to just one. Publish timestamps are also accurate, and there is more robust support for multi-architecture images.
This feature is available only on GitLab.com. Self-managed support is blocked until the next-generation Container Registry is generally available. To learn more, see issue 423459.
See Documentation and Issue.