简体   繁体   English

如何使用私有 docker 注册表创建 docker swarm 服务

[英]How to create docker swarm service with private docker registry

I have a private docker registry, and when I pull images from it everything is OK But when I want to start a docker swarm service:我有一个私有的 docker 注册表,当我从中提取图像时一切正常但是当我想启动一个 docker swarm 服务时:

docker service create --name myredis --network mynetwork --replicas 1 -p 6379:6379 myregistry:8082/redis

, it shows me next error ,它显示我下一个错误

unable to pin image myregistry:8082/redis to digest: Head http://myregistry:8082/v2/redis/manifests/latest: no basic auth credentials

How can I use my local registry while creating docker swarm services?在创建 docker swarm 服务时如何使用我的本地注册表?

Add --with-registry-auth to your docker stack deploy or docker service create commands.--with-registry-auth添加到您的docker stack deploydocker service create命令。 In a swarm, your host is logged in (so you can pull and run) but your workers are not.在 Swarm 中,您的主机已登录(因此您可以拉取并运行)但您的工作人员未登录。 This passes the login token from your local client to the swarm nodes where the service is deployed.这会将登录令牌从您的本地客户端传递到部署服务的 swarm 节点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM