docker stack deploy from compose file - all servic

2019-08-17 22:19发布

问题:

I have a docker-compose file with 10 services (containers). I have it configured one instance of each server.

When I execute the stack deploy, all 10 services go to one node (manager).

I trust that adding a second instance of a service will distribute it, but I want my 10 unique services distributed.

回答1:

If you are using a private registry its important to share the login and credentials with the worker nodes by using

docker stack deploy --with-registry-auth


回答2:

Don't have the reputation to comment but...

If you are using a private registry that requires a ca certificate --with-registry-auth alone doesn't seem to work. You need to install the ca certificate to each node.

We are using Harbor but I guess that's not that relevant.

In my case I had to do something like:

sudo mkdir -p /etc/docker/certs.d/10.10.1.5
sudo cp ca.crt /etc/docker/certs.d/10.10.1.5/.

It's really quite obvious but I spent quite some time on this and decided to share.