github.com/brahmaroutu/docker@v1.2.1-0.20160809185609-eb28dde01f16/docs/reference/commandline/swarm_join_token.md (about) 1 <!--[metadata]> 2 +++ 3 title = "swarm join-token" 4 description = "The swarm join-token command description and usage" 5 keywords = ["swarm, join-token"] 6 [menu.main] 7 parent = "smn_cli" 8 +++ 9 <![end-metadata]--> 10 11 # swarm join-token 12 13 ```markdown 14 Usage: docker swarm join-token [--rotate] (worker|manager) 15 16 Manage join tokens 17 18 Options: 19 --help Print usage 20 -q, --quiet Only display token 21 --rotate Rotate join token 22 ``` 23 24 Join tokens are secrets that allow a node to join the swarm. There are two 25 different join tokens available, one for the worker role and one for the manager 26 role. You pass the token using the `--token` flag when you run 27 [swarm join](swarm_join.md). Nodes use the join token only when they join the 28 swarm. 29 30 You can view or rotate the join tokens using `swarm join-token`. 31 32 As a convenience, you can pass `worker` or `manager` as an argument to 33 `join-token` to print the full `docker swarm join` command to join a new node to 34 the swarm: 35 36 ```bash 37 $ docker swarm join-token worker 38 To add a worker to this swarm, run the following command: 39 40 docker swarm join \ 41 --token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx \ 42 172.17.0.2:2377 43 44 $ docker swarm join-token manager 45 To add a manager to this swarm, run the following command: 46 47 docker swarm join \ 48 --token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2 \ 49 172.17.0.2:2377 50 ``` 51 52 Use the `--rotate` flag to generate a new join token for the specified role: 53 54 ```bash 55 $ docker swarm join-token --rotate worker 56 Succesfully rotated worker join token. 57 58 To add a worker to this swarm, run the following command: 59 60 docker swarm join \ 61 --token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-b30ljddcqhef9b9v4rs7mel7t \ 62 172.17.0.2:2377 63 ``` 64 65 After using `--rotate`, only the new token will be valid for joining with the specified role. 66 67 The `-q` (or `--quiet`) flag only prints the token: 68 69 ```bash 70 $ docker swarm join-token -q worker 71 72 SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-b30ljddcqhef9b9v4rs7mel7t 73 ``` 74 75 ### `--rotate` 76 77 Because tokens allow new nodes to join the swarm, you should keep them secret. 78 Be particularly careful with manager tokens since they allow new manager nodes 79 to join the swarm. A rogue manager has the potential to disrupt the operation of 80 your swarm. 81 82 Rotate your swarm's join token if a token gets checked-in to version control, 83 stolen, or a node is compromised. You may also want to periodically rotate the 84 token to ensure any unknown token leaks do not allow a rogue node to join 85 the swarm. 86 87 To rotate the join token and print the newly generated token, run 88 `docker swarm join-token --rotate` and pass the role: `manager` or `worker`. 89 90 Rotating a join-token means that no new nodes will be able to join the swarm 91 using the old token. Rotation does not affect existing nodes in the swarm 92 because the join token is only used for authorizing new nodes joining the swarm. 93 94 ### `--quiet` 95 96 Only print the token. Do not print a complete command for joining. 97 98 ## Related information 99 100 * [swarm join](swarm_join.md)