描述
每当我在 swarm 集群中使用托管在 docker hub 上的私有存储库中的图像创建服务时,我都会收到错误消息。
该服务正在运行,只是每次创建服务时打印的错误消息。
重现问题的步骤:
描述您收到的结果:
unable to pin image organization/some-image to digest: errors:
denied: requested access to the resource is denied
unauthorized: authentication required
描述您期望的结果:
没有错误信息
docker version
:
Client:
Version: 17.03.1-ce
API version: 1.27
Go version: go1.7.5
Git commit: c6d412e
Built: Fri Mar 24 00:45:26 2017
OS/Arch: linux/amd64
Server:
Version: 17.03.1-ce
API version: 1.27 (minimum version 1.12)
Go version: go1.7.5
Git commit: c6d412e
Built: Fri Mar 24 00:45:26 2017
OS/Arch: linux/amd64
Experimental: false
docker info
:
Containers: 1
Running: 1
Paused: 0
Stopped: 0
Images: 3
Server Version: 17.03.1-ce
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 33
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Swarm: active
NodeID: omkzmqvpztv77kkg4j7w6dhj9
Is Manager: true
ClusterID: zpzn4xvqs6h5drt29423a7wr6
Managers: 1
Nodes: 2
Orchestration:
Task History Retention Limit: 5
Raft:
Snapshot Interval: 10000
Number of Old Snapshots to Retain: 0
Heartbeat Tick: 1
Election Tick: 3
Dispatcher:
Heartbeat Period: 5 seconds
CA Configuration:
Expiry Duration: 3 months
Node Address: x.x.x.x
Manager Addresses:
x.x.x.x:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 4ab9917febca54791c5f071a9d1f404867857fcc
runc version: 54296cf40ad8143b62dbcaa1d90e520a2136ddfe
init version: 949e6fa
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.4.0-70-generic
Operating System: Ubuntu 16.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.66 GiB
Name: name
ID: CMZP:AJOT:ELIE:T4NT:52JS:A6U6:LYE4:DNPW:LCJB:R2UR:XO3K:CDP6
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: intezerdev
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Labels:
size=f8
provider=azure
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
其他环境详细信息(AWS、VirtualBox、物理等):
天蓝色,使用 docker-machine
这是预期的; 创建服务时,docker 不会自动传递您的凭据。 传递凭据/身份验证信息是一个显式操作(按设计),因为这些凭据将存储在 swarm 中,并分发到部署服务的节点。
要传递凭据,请在创建服务时使用--with-registry-auth
选项,或者_更新_现有服务 ( docker service update --with-registry-auth
) 上的身份验证信息。
我不认为这里有错误,但请告诉我这是否有效,或者您是否仍然遇到问题
写入Pull the image on the server
,然后部署; Swarm 模式将图像“固定”到它们的摘要中,因此请确保您的服务的所有实例运行_完全_相同版本的图像。 为此,它将联系注册中心,并解析“摘要”(不可变标签)。 为此,它需要访问注册表。 如果解析摘要失败,docker 将回退到使用您在创建服务时提供的image:tag
,并使用本地镜像(如果存在); 见https://github.com/docker/docker/issues/31518
我会继续关闭这个问题,但如果您需要更多信息,请随时继续讨论👍
最有用的评论
这是预期的; 创建服务时,docker 不会自动传递您的凭据。 传递凭据/身份验证信息是一个显式操作(按设计),因为这些凭据将存储在 swarm 中,并分发到部署服务的节点。
要传递凭据,请在创建服务时使用
--with-registry-auth
选项,或者_更新_现有服务 (docker service update --with-registry-auth
) 上的身份验证信息。我不认为这里有错误,但请告诉我这是否有效,或者您是否仍然遇到问题