Thursday, 22 August 2019

Docker Service Mode (Replicated, global) by Raj Gupta



[root@ip-172-31-83-166 ~]# docker service create -d --replicas=3 alpine ping 172.31.83.166
gnbq42aqu083vcsf1f8w8d7uz
[root@ip-172-31-83-166 ~]# docker service ls
ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
gnbq42aqu083        gallant_lamport     replicated          3/3                 alpine:latest
ip6hivkzqohi        happy_thompson      replicated          1/1                 alpine:latest
r3emkkfmh4a3        tender_chaplygin    replicated          1/1                 nginx:latest        *:8090->80/tcp



If you want to see the visual diagram of all your master and node then run the below command on master

[root@ip-172-31-83-166 ~]# docker service create   --name=viz   --publish=8080:8080/tcp   --constraint=node.role==manager   --mount=type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock   dockersamples/visualizer
6iamsonw3jrsedeudqhun1bmx
overall progress: 1 out of 1 tasks
1/1: running   [==================================================>]
verify: Service converged
[root@ip-172-31-83-166 ~]#

Now you in browser use the blow to see

http://34.203.202.233:8080/

---------------------------------------------------------------------------------------------------


If you want to create container service on all nodes even if you add any node in future then

[root@ip-172-31-83-166 ~]# docker service create --mode=global alpine ping 8.8.8.8
snrsqqnnblwx39tgccjp3w4ts
overall progress: 3 out of 3 tasks
vvj0e7oybvg7: running   [==================================================>]
ly6ri9vtmku7: running   [==================================================>]
nlkj6kdokxk3: running   [==================================================>]
verify: Service converged
[root@ip-172-31-83-166 ~]# docker service ls
ID                  NAME                MODE                REPLICAS            IMAGE                             PORTS
snrsqqnnblwx        festive_edison      global              3/3                 alpine:latest
gnbq42aqu083        gallant_lamport     replicated          3/3                 alpine:latest
ip6hivkzqohi        happy_thompson      replicated          1/1                 alpine:latest
r3emkkfmh4a3        tender_chaplygin    replicated          1/1                 nginx:latest                      *:8090->80/tcp
6iamsonw3jrs        viz                 replicated          1/1                 dockersamples/visualizer:latest   *:8080->8080/tcp
[root@ip-172-31-83-166 ~]#





1 comment:

  1. Hello everyone , here’s your opportunity for you to achieve your dreams of being a multi million dollar rich through trading , I once loss all I got through trading but was fortunate to come across a woman with great virtue and selfless heart (Mary ) i was introduce to her masterclass strategy while searching online which has revived me of all my losses and made me gain more and more . With her unique strategy you are entitled to daily signals and instant withdraw ,be rest assured of getting a refund of all your loss investment with any platform that has denied you in one way or the other in getting your money . Mrs Mary masterclass strategy is simply the best for beginners and those that are finding it difficult to succeed through trading she’ll help you with just a simple step . Email her ( maryshea03 @ Gmail .com) WhatsApp +1 562 384 7738 . Remember this is absolutely free!!!

    ReplyDelete