How can I set the swarm secret instead of having the Docker engine generate it?

When I moved to the final version 1.12 of the new built in Docker swarm support, it seems that I lost the ability to set the secret that would be used when workers and managers request to join the swarm. Now it seems that I have to let Docker set the secret and then I have to extract it from the first created node and share it with the other nodes.

When setting up a swarm programmatically, it is much easier to generate the secret and then pass it in as a parameter everywhere. How can I still do this?

Yeah there is no way to tell Docker what token to use. I think it was removed in 1.12.0-RC5. We currently use ssh within our vnet to run docker json-token manager|worker in order to get the token for all of the workers. It stinks, but I think it works as long as you have access to a manager (I don’t think you need access to the leader, iirc).