Linux入门教程:Docker命令行参考(36) – docker swarm join-token管理加入令牌,有两种可用的不同的j
Linux入门教程:Docker命令行参考(36) – docker swarm join-token管理加入令牌,有两种可用的不同的j
Usage: docker swarm join-token [--rotate] (worker|manager) Manage join tokens Options: --help Print usage -q, --quiet Only display token --rotate Rotate join tokenJoin tokens是允许一个节点加入集群的密钥。有两种可用的不同的join tokens,一个是用作worker角色,另一个是用作manager角色。在执行swarm join时使用–token来传递token。节点只在它们加入集群时才使用这个token。
使用swarm join-token可以查看或更换join token。
为方便起见,可以传递worker或manager到join-token来打印出完整的docker swarm join命令来加入一个新的节点到集群。
$ 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使用–rotate参数来为指定的角色生成一个新的join token:
$ docker swarm join-token --rotate worker Succesfully rotated worker join token. To add a worker to this swarm, run the following command: docker swarm join \ --token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-b30ljddcqhef9b9v4rs7mel7t \ 172.17.0.2:2377使用–rotate更新token之后,只能用新的token来加入集群。
-q或–quiet参数只打印token:
$ docker swarm join-token -q worker SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-b30ljddcqhef9b9v4rs7mel7t
评论暂时关闭