Search code examples
dockerdocker-swarm

Swarm cluster issue


I am trying to configure swarm cluster for my http service. But it looks like the http container was not getting started on my worker node even though i set the replica while creating service as 3.

docker service create --name www -p 8080:8080 -replicas 3 nginxdemos/hello

7697736869d5        nginxdemos/hello:latest              "nginx -g 'daemon 
of…"   9 minutes ago       Up 9 minutes        80/tcp              
www.3.ondv0trbihswroe32n7hbdwy6
e77cef0511b8        nginxdemos/hello:latest              "nginx -g 'daemon 
of…"   9 minutes ago       Up 9 minutes        80/tcp              
www.2.266mjs85leavrvwb0yik23hzh
09594341b984        nginxdemos/hello:latest              "nginx -g 'daemon 
of…"   9 minutes ago       Up 9 minutes        80/tcp              
www.1.m1syq4qchmzwm6qcpm1sikeax

[root@slc07gpc ~]# docker node ls
ID                            HOSTNAME                 STATUS              
AVAILABILITY        MANAGER STATUS
2c87tpbao6bpv57l2y2fk20un *   manager1                 Ready               
Active              Leader
mym5vl8xo29dnbxlcwt4fhe23     manager2                 Ready               
Active
yxj0gok5ii5o3bnewyn7gno61     manager2                 Down                
Active
w16a3p2owe5tb4n09wv8qm1jb     worker1                 Ready               
Active
vk37whv1ov8micyd30s48u14q     worker2                 Ready               
Active

Issue is the container was not started and i could not see any docker process when i execute ps -a on manager2,worker1,worker2. Can someone please help me


Solution

  • It looks like you have one manager, with 3 workers (and one down node yxj0gok5ii5o3bnewyn7gno61).

    Assuming you have NO other services/containers running in the swarm, you may have network issues preventing proper task creation on other nodes. Try removing all nodes from the swarm docker swarm leave except the manager1 and one other node. Then remove and recreate service and see what happens. Try creating it without publishing a port, and see what happens.

    Then maybe if it's still an issue you can update your answer with the results. Also showing your docker versions and general network setup would be good.