Browse Source

swarm

master
test2 5 years ago
parent
commit
90ecf28bc9
  1. 82
      DockerSwarm/Creaate-Swarm.adoc
  2. 2
      DockerSwarm/index.adoc

82
DockerSwarm/Creaate-Swarm.adoc

@ -73,5 +73,87 @@ Worker nodes are also instances of Docker Engine whose sole purpose is to execut
You can create a swarm of one manager node, but you cannot have a worker node without at least one manager node. By default, all managers are also workers.
== Create swarm
Initialize a swarm. The docker engine targeted by this command becomes a manager in the newly created single-node swarm.
.create swarm
[source,sh]
----
docker swarm init --advertise-addr ip
Swarm initialized: current node (bvz81updecsj6wjz393c09vti) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join \
--token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx \
172.17.0.2:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
----
=== Join token
Join tokens are secrets that allow a node to join the swarm.
There are two different join tokens available,
- one for the worker role and
- one for the manager role.
.join token
[source,sh]
----
docker swarm join-token worker
To add a worker to this swarm, run the following command:
docker swarm join \
--token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx \
172.17.0.2:2377
docker swarm join-token manager
To add a manager to this swarm, run the following command:
docker swarm join \
--token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2 \
172.17.0.2:2377
----
=== Join swarm
Join a node to a swarm. The node joins as a manager node or worker node based upon the token you pass with the --token flag. If you pass a manager token, the node joins as a manager. If you pass a worker token, the node joins as a worker.
.join worker
[source,sh]
----
docker swarm join --token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx --advertise-addr eth1:2377 192.168.99.121:2377
This node joined a swarm as a worker.
----
.join manager
[source,sh]
----
docker swarm join --token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2 --advertise-addr eth1:2377 192.168.99.121:2377
This node joined a swarm as a manager.
----
=== Leave swarm
When you run this command on a worker, that worker leaves the swarm.
----
docker swarm leave
----
You can use the *--force* option on a manager to remove it from the swarm.
[NOTE]
.INFO
====
The safe way to remove a manager from a swarm is to *demote* it to a worker and then direct it to leave the quorum without using --force
====

2
DockerSwarm/index.adoc

@ -26,7 +26,7 @@ Swarm - Cloud
=== http://docs.swarmlab.io/lab/DockerSwarm/Intro-Cloud.adoc.html[Intro Cloud]
=== http://docs.swarmlab.io/lab/DockerSwarm/Creaate-Swarm.adoc.html[Intro Cloud]
=== http://docs.swarmlab.io/lab/DockerSwarm/Creaate-Swarm.adoc.html[Create Swarm]

Loading…
Cancel
Save