Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 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?

like image 849
Nurzhan Aitbayev Avatar asked Oct 27 '25 23:10

Nurzhan Aitbayev


1 Answers

Add --with-registry-auth to your docker stack deploy or docker service create commands. In a swarm, your host is logged in (so you can pull and run) but your workers are not. This passes the login token from your local client to the swarm nodes where the service is deployed.

like image 167
Siyu Avatar answered Oct 29 '25 15:10

Siyu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!