docker - 从 GCR (Google Container Registry) 导出 Docker 镜像

标签 docker google-cloud-platform google-kubernetes-engine google-container-registry

我使用 GCR(谷歌容器注册表)作为我的 Docker 镜像注册表,为 GKE(谷歌 Kubernetes 引擎)部署服务。我的渗透测试团队要求我提供来自 GCR 的 Docker 镜像以供他们进行测试。

我可以在本地创建 Docker 镜像,但这并不是他们想要的。

如何将 Docker 镜像从 GCR 下载到我的 PC?

然后接下来,我该如何着手复制 Docker 镜像并将其移交给渗透测试团队。

最佳答案

引用文档:

You can access Container Registry through secure HTTPS endpoints, which allow you to push, pull, and manage images from any system, VM instance, or your own hardware. Additionally, you can use the Docker credential helper command-line tool to configure Docker to authenticate directly with Container Registry.

如您所见here继续向一个或多个用户授予项目内访问容器寄存器的权限的方法:

Pull (Read Only)    
roles/storage.objectViewer  Storage Object Viewer :    
 - storage.objects.get
 - storage.objects.list

完成此操作后,您可以安装经典的 google Cloud SDK 并登录,您应该能够验证 docker 并拉取正在运行的图像:

  $ gcloud auth configure-docker
  $ docker pull [HOSTNAME]/[PROJECT-ID]/[IMAGE][:TAG]

请注意,您还可以决定创建一个公开的图像并拉取它只运行经典的:

  $ docker pull [HOSTNAME]/[PROJECT-ID]/[IMAGE][:TAG]

Step to Step指南展示了如何去做。

更新

由于您似乎有兴趣以良好的格式将其保存在本地磁盘上并将其交给其他团队,these这样做的可能步骤是:

$ gcloud auth configure-docker
$ docker pull [HOSTNAME]/[PROJECT-ID]/[IMAGE][:TAG]
$ docker save IMAGENAME:TAG -o FILENAME.tar

请注意,就我现在而言,只有在运行 docker images

时才能保存图像

更多文档:Difference between save and export in Docker

关于docker - 从 GCR (Google Container Registry) 导出 Docker 镜像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50460973/

相关文章:

jenkins - Google Cloud Jenkins gcloud 推送访问被拒绝

ruby - Docker 容器知道 rbenv 全局但不知道 ruby

mysql - 访问与 --link 链接的 Docker 容器中的环境变量

php - 是否可以在 nginx 没有安装卷的情况下将请求传递给 php-fpm

amazon-web-services - 是否有 AWS/Azure/Gcloud API 的包装器?

使用 VPA 的 Kubernetes 自动缩放 - 关闭还是自动更新模式?

docker - 启动Docker容器的几个端口

security - 任何解决Google 15,000至75,000美元OAuth安全评估的方法

flutter - 通过 strip 集成保护 google firebase 云功能

jenkins - Pylint 与作为代理在动态 kubernetes pod 上运行的 Jenkins 构建的集成