github.com/brahmaroutu/docker@v1.2.1-0.20160809185609-eb28dde01f16/docs/reference/commandline/swarm_join.md (about) 1 <!--[metadata]> 2 +++ 3 title = "swarm join" 4 description = "The swarm join command description and usage" 5 keywords = ["swarm, join"] 6 [menu.main] 7 parent = "smn_cli" 8 +++ 9 <![end-metadata]--> 10 11 # swarm join 12 13 ```markdown 14 Usage: docker swarm join [OPTIONS] HOST:PORT 15 16 Join a swarm as a node and/or manager 17 18 Options: 19 --advertise-addr value Advertised address (format: <ip|interface>[:port]) 20 --help Print usage 21 --listen-addr value Listen address (format: <ip|interface>[:port) 22 --token string Token for entry into the swarm 23 ``` 24 25 Join a node to a swarm. The node joins as a manager node or worker node based upon the token you 26 pass with the `--token` flag. If you pass a manager token, the node joins as a manager. If you 27 pass a worker token, the node joins as a worker. 28 29 ### Join a node to swarm as a manager 30 31 The example below demonstrates joining a manager node using a manager token. 32 33 ```bash 34 $ docker swarm join --token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2 192.168.99.121:2377 35 This node joined a swarm as a manager. 36 $ docker node ls 37 ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS 38 dkp8vy1dq1kxleu9g4u78tlag * manager2 Ready Active Reachable 39 dvfxp4zseq4s0rih1selh0d20 manager1 Ready Active Leader 40 ``` 41 42 A cluster should only have 3-7 managers at most, because a majority of managers must be available 43 for the cluster to function. Nodes that aren't meant to participate in this management quorum 44 should join as workers instead. Managers should be stable hosts that have static IP addresses. 45 46 ### Join a node to swarm as a worker 47 48 The example below demonstrates joining a worker node using a worker token. 49 50 ```bash 51 $ docker swarm join --token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx 192.168.99.121:2377 52 This node joined a swarm as a worker. 53 $ docker node ls 54 ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS 55 7ln70fl22uw2dvjn2ft53m3q5 worker2 Ready Active 56 dkp8vy1dq1kxleu9g4u78tlag worker1 Ready Active Reachable 57 dvfxp4zseq4s0rih1selh0d20 * manager1 Ready Active Leader 58 ``` 59 60 ### `--listen-addr value` 61 62 If the node is a manager, it will listen for inbound Swarm manager traffic on this 63 address. The default is to listen on 0.0.0.0:2377. It is also possible to specify a 64 network interface to listen on that interface's address; for example `--listen-addr eth0:2377`. 65 66 Specifying a port is optional. If the value is a bare IP address, or interface 67 name, the default port 2377 will be used. 68 69 This flag is generally not necessary when joining an existing swarm. 70 71 ### `--advertise-addr value` 72 73 This flag specifies the address that will be advertised to other members of the 74 swarm for API access. If unspecified, Docker will check if the system has a 75 single IP address, and use that IP address with with the listening port (see 76 `--listen-addr`). If the system has multiple IP addresses, `--advertise-addr` 77 must be specified so that the correct address is chosen for inter-manager 78 communication and overlay networking. 79 80 It is also possible to specify a network interface to advertise that interface's address; 81 for example `--advertise-addr eth0:2377`. 82 83 Specifying a port is optional. If the value is a bare IP address, or interface 84 name, the default port 2377 will be used. 85 86 This flag is generally not necessary when joining an existing swarm. 87 88 ### `--manager` 89 90 Joins the node as a manager 91 92 ### `--token string` 93 94 Secret value required for nodes to join the swarm 95 96 97 ## Related information 98 99 * [swarm init](swarm_init.md) 100 * [swarm leave](swarm_leave.md) 101 * [swarm update](swarm_update.md)