Where is the docker swarm token stored?

Sakr picture Sakr · Oct 9, 2015 · Viewed 15.6k times · Source

I've created a docker-machine swarm cluster using a new generated token, which was stored within an environment variable. The environment variable was only for valid for the current session, and is deleted afterward. Now I want to add a new docker-machine to the same cluster, but I can't find the needed token.

How is it possible to find out the token used by an active docker swarm ?

Answer

mrlitsta picture mrlitsta · Jul 25, 2017

Answering for posterity, since I had no luck with the other answer.

Running Docker 17.05. Docker can now list join tokens for both workers and managers.

$ docker swarm join-token manager

To add a manager to this swarm, run the following command:

docker swarm join \
--token SWMTKN-1-13z9uafwgjdkfv3ik18ttceqgtogdqr4xurhc6vaybeckx7i7u-2lnnyzeqb93ejgjrdlivsg7rf \
10.0.0.18:2377



$ docker swarm join-token worker
To add a worker to this swarm, run the following command:

docker swarm join \
--token SWMTKN-1-13z9uafwgjdkfv3ik18ttceqgtogdqr4xurhc6vaybeckx7i7u-b3a28we1he23rxwk2rea933y4 \
10.0.0.18:2377

More information: https://docs.docker.com/engine/reference/commandline/swarm_join-token/