如何将 Virtual Box 中的 Docker 镜像推送到 Google 存储库?



我有一个虚拟框development

$docker-machine ls
NAME          ACTIVE   DRIVER     STATE        URL             SWARM  DOCKER ERRORS
development    -     virtualbox  Running  tcp://*.*.*.*:****  v18.05.0-ce   

development里面我有这个:

$docker images
REPOSITORY            TAG      IMAGE ID         CREATED         SIZE
busybox              latest   e1ddd7948a1c      1 day ago      1.16MB
pritam/play-docker   latest   34eb2664f14e      1 day ago      1.4GB

现在我想将虚拟框中的这个图像推送到谷歌存储库。我该怎么做?

你可以使用 docker push 命令

docker push imageTagName

http://docs.docker.com/engine/reference/commandline/push

对于您自己的注册表,您可以使用

 docker push registry.example.com/image 

http://blog.docker.com/2013/07/how-to-use-your-own-registry。

对于谷歌容器注册表参考:

http://cloud.google.com/container-registry/docs/pushing-and-pulling

docker [push/pull] gcr.io/{PROJECT_ID}/{image}:tag 

有关身份验证,您可以查看 Google 容器注册表参考

https://medium.com/google-cloud/using-googles-private-container-registry-with-docker-1b470cf3f50a

在获取 JSON 格式的 Google 身份验证密钥 (key.json( 后

docker login -u _json_key -p “$(cat key.json)”

登录成功后,您可以推送您的镜像

 docker push gcr.io/project_id/imageName:tag

最新更新