有没有办法直接将容器从 docker 集线器部署到 google 计算引擎?

Is there a way to directly deploy a container from docker hub to google compute engine?

当您在 google 计算引擎上创建实例时,有一个选项 "Deploy a container image to this VM instance",如果您 select 要求容器映像

在容器图像的框中显示 "for example, gcr.io/google-containers/busybox" 并单击单词 "Container image" 旁边的问号会显示 "Name of a public image on any registry, or a private image hosted on Google Container Registry."

据此我推断我可以直接从 docker 中心部署图像,而无需先将其上传到 google 容器存储库。但是,我在如何将实例定向到所需图像方面遇到了问题。

例如,如果图像是 username/repo:tag,我尝试将 username/repousername/repo:tag 作为容器图像,但是当我加载实例时,我不在容器和图像甚至没有在 docker images -a

中列出

我应该使用什么地址?

是的,您可以直接从 docker 中心部署映像。

在 GCE 中创建实例时,在 Container Image 文本框中,您必须键入 docker hub 存储库的完整路径。

例如,对于 nginx public docker 镜像,您应该输入的容器镜像是 registry.hub.docker.com/library/nginx

任何官方 docker 中心图像的注册表路径应按以下方式编写:registry.hub.docker.com/library/image

对于私有 docker 镜像,您应该输入的容器镜像是 registry.hub.docker.com/username/reporegistry.hub.docker.com/username/repo:tag

docker.io/<username>/<repo>:<tag> 也可以。当然,它指向与 registry.hub.docker.com 相同的注册表,但模式与 gcr.io/<username>/<repo>:<tag>.

非常匹配

您可以使用registry.hub.docker.com/<username>/<image-name>:<tag>

所以要部署到 GKE