docker_advanced_install_swarm_intro

This is an old revision of the document!


In other technologies we have clusters, in docker, we have Swarm. Same concept, different name :)

A swarm in docker is set of servers who act as one and each server can be either: Manager or Worked. It is important to note, that manager is also a worked, but the reverse isn't so. Managers manage workers and workers obey, nothing different than clusters.

Below, you can see basic overview of the swarm:

Let's set it up. We will have 3 servers:

  • 1 Manager
  • 2 Workers

You can see the creation in the Vagrant section: Multiple Servers Configuration with Vagrant

After the setup is done, please be sure that workers, have joined, we can create the service as follows:

The creation of the service is rather easy:

[root@mgr1 ~]# docker service create --name httpDemoService --replicas 3 andonovj/httpserverdemo
q8s7iiv4rwu7pymf2qnelglgx
overall progress: 3 out of 3 tasks
1/3: running   [==================================================>]
2/3: running   [==================================================>]
3/3: running   [==================================================>]
verify: Service converged
[root@mgr1 ~]# docker service ls
ID                  NAME                MODE                REPLICAS            IMAGE                            PORTS
q8s7iiv4rwu7        httpDemoService     replicated          3/3                 andonovj/httpserverdemo:latest
[root@mgr1 ~]#
[root@mgr1 ~]#
[root@mgr1 ~]#
[root@mgr1 ~]#
[root@mgr1 ~]# docker node ls
ID                            HOSTNAME            STATUS              AVAILABILITY        MANAGER STATUS      ENGINE VERSION
occzvuwmny5rm8x8an4bctdc1 *   mgr1                Ready               Active              Leader              19.03.7
7oubfm1qdun533xw9s14lt3pu     worker01            Ready               Active                                  19.03.7
sdcosdbt1f94rrvbr8m9ng30s     worker02            Ready               Active                                  19.03.7
[root@mgr1 ~]#

  • docker_advanced_install_swarm_intro.1583751649.txt.gz
  • Last modified: 2020/03/09 11:00
  • by andonovj