docker - 如何检查图片:tag exists in gitlab container registry

标签 docker gitlab gitlab-ci container-registry

我知道可以使用dockerhub完成此操作。我想知道是否有类似的东西可用于gitlab注册表。

用例是,我编写了一个结构脚本,以将部署还原为用户提供的特定标签。在实际提取图像之前,我想知道注册表中是否存在带有指定标签的图像,并相应地警告用户。

我已经搜索了他们的文档,但找不到任何东西。

注意:这里的用户是部署代码的人。

最佳答案

除非GitLab Container Registry支持kind of curl dockerhub does(带有v1/repositories/$1/tags/$2),否则我怀疑它是否提供该功能。

例如,issue 26866 "GitLab Registry available images list/search"在10个月后仍处于打开状态。

适用于GitLab 12.2的更新(2019年4月,18个月后)

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 to GET /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:


这样可以帮助检查是否存在image:tag

更新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.

https://docs.gitlab.com/ee/user/packages/container_registry/img/container_registry_repositories_with_quickstart_v13_0.png



参见documentationissue

关于docker - 如何检查图片:tag exists in gitlab container registry,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47660841/

相关文章:

docker - 无法在 Linux 上将 Docker 与 pymongo 连接

docker - 如何在 podman 容器中设置 gitlab-runner 以使用执行器选项 docker(使用 podman)

gitlab - 如何将 gitlab-ci.yml 文件移出存储库

continuous-integration - GitLab Runner CI/CD 中用户模式和系统模式的区别

powershell - 如何在 GitLab CI YAML 文件中包含 PowerShell 脚本文件

docker - 无法与 Docker 中的容器共享本地 Windows 路径

node.js - Nodemon 在 Windows Docker 环境中不重启

amazon-web-services - 将 AWS 凭证(IAM 角色凭证)传递给在 docker 容器中运行的代码

linux - 无法以普通用户身份推送到 git 存储库

github - Gitlab 可以向匿名用户公开构建和覆盖徽章吗?