Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
docker_advanced_install_swarm_intro [2020/03/09 11:56] – andonovj | docker_advanced_install_swarm_intro [2020/03/09 12:18] (current) – [Create service] andonovj | ||
---|---|---|---|
Line 35: | Line 35: | ||
That command will initialize a swarm with 1 manager who will listen on IP: 10.100.199.200: | That command will initialize a swarm with 1 manager who will listen on IP: 10.100.199.200: | ||
+ | ===Addition=== | ||
+ | To join a swarm a server must have the swarm' | ||
- | Manually | + | < |
+ | [root@mgr1 ~]# docker swarm join-token manager | ||
+ | To add a manager to this swarm, run the following command: | ||
+ | |||
+ | docker swarm join --token SWMTKN-1-4mqe4htimsl9wrlzstzx6c18qmibjfjuuihdp3o91pnmssbvml-69b13glzhdgfzh58hbg7jwn69 10.100.199.200: | ||
+ | |||
+ | [root@mgr1 ~]# docker swarm join-token worker | ||
+ | To add a worker to this swarm, run the following command: | ||
+ | |||
+ | docker swarm join --token SWMTKN-1-4mqe4htimsl9wrlzstzx6c18qmibjfjuuihdp3o91pnmssbvml-1h1yrqixgrme7aypq6c4m0npj 10.100.199.200: | ||
+ | |||
+ | [root@mgr1 ~]# | ||
+ | |||
+ | </ | ||
+ | |||
+ | Now, it is good idea to ALWAYS add the advertise and listener address to the server: | ||
+ | |||
+ | Manually, | ||
- | < | + | < |
docker swarm join --token SWMTKN-1-4mqe4htimsl9wrlzstzx6c18qmibjfjuuihdp3o91pnmssbvml-1h1yrqixgrme7aypq6c4m0npj \ | docker swarm join --token SWMTKN-1-4mqe4htimsl9wrlzstzx6c18qmibjfjuuihdp3o91pnmssbvml-1h1yrqixgrme7aypq6c4m0npj \ | ||
manager_advertise_ip: | manager_advertise_ip: | ||
Line 45: | Line 64: | ||
</ | </ | ||
- | The token can be taken from the manager | + | Insert the correct |
- | + | ||
- | < | + | |
- | [root@mgr1 ~]# docker swarm join-token --quiet manager | + | |
- | SWMTKN-1-4mqe4htimsl9wrlzstzx6c18qmibjfjuuihdp3o91pnmssbvml-69b13glzhdgfzh58hbg7jwn69 | + | |
- | [root@mgr1 ~]# docker swarm join-token --quiet | + | |
- | SWMTKN-1-4mqe4htimsl9wrlzstzx6c18qmibjfjuuihdp3o91pnmssbvml-1h1yrqixgrme7aypq6c4m0npj | + | |
- | [root@mgr1 ~]# | + | |
- | </ | + | |
=====Create service===== | =====Create service===== | ||
Line 59: | Line 70: | ||
<sxh bash> | <sxh bash> | ||
- | [root@mgr1 ~]# docker service create --name httpDemoService --replicas 3 andonovj/ | + | [root@mgr1 ~]# docker service create --name httpDemoService --replicas 3 -p 80: |
- | q8s7iiv4rwu7pymf2qnelglgx | + | nz82mserbonjcoccp7iir7hfn |
overall progress: 3 out of 3 tasks | overall progress: 3 out of 3 tasks | ||
1/3: running | 1/3: running | ||
Line 79: | Line 90: | ||
sdcosdbt1f94rrvbr8m9ng30s | sdcosdbt1f94rrvbr8m9ng30s | ||
[root@mgr1 ~]# | [root@mgr1 ~]# | ||
+ | [root@mgr1 ~]# docker service ps httpDemoService | ||
+ | ID NAME IMAGE NODE DESIRED STATE | ||
+ | avcanadogs3e | ||
+ | 6pgfba2xdg0q | ||
+ | me2174rye7nu | ||
+ | [root@mgr1 ~]# | ||
+ | |||
</ | </ | ||