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