【问题标题】:GCR using CLI to retrieve tagless imagesGCR 使用 CLI 检索无标记图像
【发布时间】:2018-03-17 02:45:06
【问题描述】:

我知道您可以执行以下操作来检索特定图像的标签列表:

gcloud 容器镜像列表 --repository=gcr.io/myproject

但我想知道我是否也可以使用 gcloud CLI 来检索没有标签的图像。

无标签图像显示在 Google 云控制台 Web 界面中。

解决方案

gcloud 容器镜像列表标签 gcr.io/myproject/repo --filter='-tags:*'

【问题讨论】:

    标签: gcloud google-container-registry gcloud-cli


    【解决方案1】:

    list-tags 会更好地满足您的需求。具体来说,如果您想查看所有图像(包括未标记的图像)的信息:

    gcloud container images list-tags gcr.io/project-id/repository --format=json

    如果您想打印未标记图像的摘要:

    gcloud container images list-tags gcr.io/project-id/repository --filter='-tags:*' --format='get(digest)' --limit=$BIG_NUMBER

    【讨论】:

    • 第一个命令没有给我未标记的图像,但 --filter='-tags:*' 部分成功了!
    【解决方案2】:

    我认为您正在寻找的是list-tags 子命令:

    gcloud container images list-tags --repository=gcr.io/myproject/myrepo
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-04-06
      • 2021-09-19
      • 2022-11-21
      • 1970-01-01
      • 2011-09-06
      • 2019-11-24
      • 1970-01-01
      相关资源
      最近更新 更多