The software described in this documentation is either no longer supported or is in extended support.
Oracle recommends that you upgrade to a current supported release.

6.1.1 Initialize the swarm on a host selected as the management node

Creating a new swarm is a simple operation. On a host running Docker Engine 1.12 or later, run the following command:

# docker swarm init --advertise-addr IP Address:PORT

Substitute IP Address with the IP address or device name of the network interface that manager nodes should use to communicate between each other and to facilitate overlay networking. If the system has a single network interface or IP address, you do not need to use the --advertise-addr option. You can optionally specify the TCP port that should be used for API communication across the swarm, by default this is achieved on port 2377.

Two secret keys, or join tokens, are created when the swarm is initialized. These keys are used to authenticate nodes that are attempting to join the swarm and, depending on the key used, can control whether a node joins the swarm as a worker node or as a manager node. You are able to see or reset the key values at any point by running the swarm join-token command on any manager node. Example usage of this command follows below:

# docker swarm join-token worker
To add a worker to this swarm, run the following command:
    docker swarm join \
    --token SWMTKN-1-0np2hom3z5q03qboqft2nm4n8flyv4n1grnubow2rzejwdd7j2-93gbsv348qg1pnp5zwyuhynj3\

# docker swarm join-token manager
To add a manager to this swarm, run the following command:
    docker swarm join \
    --token SWMTKN-1-0np2hom3z5q03qboqft2nm4n8flyv4n1grnubow2rzejwdd7j2-3szdu6g3q5szgvartiwas5of8\

The command returns the docker command that should be run on the system that you wish to add to the swarm as either a manager or worker node.

Use the --rotate option to rotate or refresh the keys. If a key is rotated, the old key value can no longer be used to join a new node to the swarm. The key tokens are important to protecting the integrity of the swarm. Manager keys are particularly important to the security and stability of the swarm. If you think that a key has been stored or published in plain text somewhere, it is good practice to rotate the key.