Imagine you want to reset your Docker swarm from time to time.

How do you distribute join tokens to those zillions of nodes? How much automation is possible here?

2 Answers 2


Have the Swarm Manager place the worker join token in a Key/Value store. We use AWS Parameter Store but I believe Consul would be another option (I don't use it).

Each node can then retrieve the token while it is bootstrapping.

  • what if you have more than 1 manager?
    – Ta Mu
    Commented Jan 26, 2018 at 7:21
  • The manager join token can be stored in a K/V store as well. The initial manager token is the starting point for rebuilding or bootstrapping the Swarm.
    – swysocki
    Commented Jan 26, 2018 at 13:05

Simple answer with infrastructure as code, you don't rejoin nodes, you trash old nodes and bring fresh nodes to join the cluster.

  • still you need to tell the new nodes as well how they join as worker either manager. Or do you mean once a token is there you bake it into their IaC?
    – Ta Mu
    Commented Jan 26, 2018 at 7:22
  • 1
    I just mean same principle as building a new cluster, code your cluster building process and then when you want to reset, build a new and trash the old one. How you code this is fairly personal ...
    – Tensibai
    Commented Jan 26, 2018 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.