To create the four copy of container
[root@ip-172-31-83-166 ~]# docker service create -d --replicas 4 alpine ping 172.31.83.166
befib2ehy1bkmpduqv98qip60
[root@ip-172-31-83-166 ~]# docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
8ybsu9bgen5e confident_poincare replicated 1/1 alpine:latest
lc7l8xvo9a0o nifty_albattani replicated 1/1 alpine:latest
befib2ehy1bk optimistic_kilby replicated 4/4 alpine:latest
[root@ip-172-31-83-166 ~]#
[root@ip-172-31-83-166 ~]# docker service create -d --replicas 4 alpine ping 172.31.83.166
befib2ehy1bkmpduqv98qip60
[root@ip-172-31-83-166 ~]# docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
8ybsu9bgen5e confident_poincare replicated 1/1 alpine:latest
lc7l8xvo9a0o nifty_albattani replicated 1/1 alpine:latest
befib2ehy1bk optimistic_kilby replicated 4/4 alpine:latest
[root@ip-172-31-83-166 ~]#
To get the details of all process of service
[root@ip-172-31-83-166 ~]# docker service ps befib2ehy1bk
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
of1nea5konsa optimistic_kilby.1 alpine:latest ip-172-31-81-43 Running Running 6 minutes ago
x2vcdvzoh0q0 optimistic_kilby.2 alpine:latest ip-172-31-81-43 Running Running 6 minutes ago
hcky0bjjk9v3 optimistic_kilby.3 alpine:latest ip-172-31-88-27 Running Running 6 minutes ago
b7xovnxo2u6p optimistic_kilby.4 alpine:latest ip-172-31-83-166 Running Running 6 minutes ago
replicas services will act like auto-scaling in above case if some delete the 1 or more container then master will create again new container so that total count will be four
No comments:
Post a Comment