Search code examples
dockervirtualboxdocker-swarmswarm

Is the 'local' vm required once the swarm cluster has been deployed?


According to the official documentation on Install and Create a Docker Swarm, first step is to create a vm named local which is needed to obtain the token with swarm create.

Once the manager and all nodes have been created and added to the swarm cluster, do I need to keep running the local vm?


Solution

  • Note: this tutorial is for the first version of Swarm (called Swarm legacy). There is a new version called Swarm mode available since Docker 1.12. Putting it out there because there seems to be a lot of confusion between the two.

    No you don't have to keep the local VM, this is just to get a unique cluster token with the Docker Hub discovery service.

    Now this is a bit overkill just to generate a token. You can bypass this step by:

    • Running the swarm container directly if you have Docker for Mac or a more generally a local instance of Docker running:

      docker run --rm swarm create
      
    • Directly query the service discovery URL to generate a token:

      curl -X POST "https://discovery.hub.docker.com/v1/clusters"