寻找一种使用 gcloud 命令行获取容器引擎注册表镜像标签的方法。
这个命令
cloud docker search gcr.io/PROJECT/myimage
回报
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
PROJECT/myimage 0
但我想看看到目前为止使用的标签,就像 gcloud Web 控制台显示的那样。
我运行此命令的机器从 docker hub 中提取图像,标记它们,然后使用
gcloud docker push...
将它们推送到 google 容器引擎
我怀疑我可能会问如何让本地 docker 客户端对 google repo 和 docker hub repo 执行命令,这样我就可以获得
docker images
列表
****** 更新:请参阅 https://stackoverflow.com/a/38061253/201911 了解最新版本中的此功能。
gcloud container images list-tags gcr.io/PROJECT/myimage
https://cloud.google.com/sdk/gcloud/reference/container/images/list-tags
让我告诉你一些缓解疼痛的方法:
ZONE=eu
PROJECT_ID=testproject
PROJECT_URL=gs://${ZONE}.artifacts.${PROJECT_ID}.appspot.com/containers/repositories/library
# this generates images list
gsutil ls $PROJECT_URL | sed -e 's#/$##' -e 's#.*/##'
IMAGE_URL=gs://${ZONE}.artifacts.${PROJECT_ID}.appspot.com/containers/repositories/library/${IMAGE_NAME}/
# this generates tags list for specified image
gsutil ls $IMAGE_URL | sed -n '/\/tag_/ { s#.*/tag_##p }'
这在大多数情况下都会为您服务。
您需要读取权限才能列出 GCE 中特定存储桶中的文件。
这目前无法通过
gcloud
实现。 gcloud docker
只是 docker
命令行工具的包装,它不容易公开您想要的远程存储库信息。
在未来的某个时候,
gcloud
可能会支持此功能。
首先安装 gcloud CLI(在 MacOS 上为
brew install google-cloud-sdk
)。然后登录(gcloud auth login
)。然后使用下面的命令列出图像/标签。
列出图像
CLOUDSDK_CORE_PROJECT=[PROJECT] gcloud container images list
(例如CLOUDSDK_CORE_PROJECT=spiffe-io gcloud container images list
)
列出图像标签
gcloud container images list-tags gcr.io/[PROJECT]/[IMAGE]
(例如gcloud container images list-tags gcr.io/spiffe-io/spire-server
)
目前无法跨所有项目搜索图像。
看