【发布时间】:2021-06-07 05:21:41
【问题描述】:
我有一个 2 节点的 swarm 集群,配置如下
我已经配置了Google Container Registry来推拉图片
在配置了 docker swarm 的主机/本地机器中,我可以使用以下命令轻松登录谷歌容器注册表并推送/拉取图像
$ gcloud auth print-access-token | sudo docker login -u oauth2accesstoken --password-stdin https://gcr.io
WARNING: Could not setup log file in /home/arush/.config/gcloud/logs, (PermissionError: [Errno 13] Permission denied: '/home/arush/.config/gcloud/logs/2021.03.09/15.17.13.106143.log')
WARNING! Your password will be stored unencrypted in /home/arush/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
我使用here提到的访问令牌方法登录
现在,如果我尝试使用以下命令在管理器节点上的 swarm 内创建服务,我会收到类似图像未找到的消息
$ docker service create --name app1 --with-registry-auth -p 5003:5000 app1
如何从 swarm 集群中登录 google 容器注册表并拉取镜像并创建服务
【问题讨论】:
标签: docker google-cloud-platform docker-swarm docker-registry