Where is the docker swarm token stored?

Where is the docker swarm token stored?

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/

This article explains how this can be achieved:

Getting the Docker Swarm Discovery Token

Execute: docker inspect $SWARM_AGENT_MASTER where $SWARM_AGENT_MASTER is the name of the container.

Where is the docker swarm token stored?

Just ssh into manager and get the tokens, like the following.

# get manager and worker tokens
 export MANAGER_TOKEN=`docker-machine ssh $SWARM_AGENT_MASTER docker swarm join-token manager -q`
 export WORKER_TOKEN=`docker-machine ssh $SWARM_AGENT_MASTER docker swarm join-token worker -q`

Leave a Reply

Your email address will not be published.