github.com/olljanat/moby@v1.13.1/docs/reference/commandline/swarm_join_token.md (about)

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