dockerdocker-composedockerfiledocker-swarmswarm

docker swarm - fail to deploy on workers node


I setup the Docker Swarm cluster with one manager node and 2 worker nodes:

    swarm-admin@node-1:~$ docker node ls
ID                            HOSTNAME            STATUS              AVAILABILITY        MANAGER STATUS      ENGINE VERSION
de4zdkoxazsjqch5tczk5czqo *   node-1        Ready               Active              Leader              19.03.12
lhxspp75cqve5hq99gxcjs0hz     node-2        Ready               Active                                  19.03.12
mgcoy9sk2apa6p0ah6gmekk99     node-3        Ready               Active                                  19.03.12

and try to deploy a stack with docker compose:

version: '3'
services:
    tests:
        image: myrepo/image
        ports:
          - "80:80"
          - "443:443"

but the stack only deploy on the master node only, it is trying to deploy to others node, but it face "Reject" and then deploy to manager node successfully. I use below command to run a stack:

docker stack deploy -c docker-compose.yml test-stack

Can anybody support me?


Solution

  • Try this

    docker stack deploy -c docker-compose.yml test-stack --with-registry-auth