Now that we have reviewed the Docker Swarm architecture and the command-line actions required to initialize the cluster, we can create a cluster. By the end of this chapter, we will have a fully functional cluster with high availability. Let's start by reviewing the Docker Swarm cluster creation process:
- First, we initialize a Swarm cluster on a manager node. This node automatically becomes the cluster leader because no other manager is available. If we have a node with multiple interfaces, we will choose which interface will be associated with the control plane and which ones will be announced for other nodes and the Swarm API. The output will vary from the following in your environment. Let's execute docker swarm init:
$ docker swarm init
Swarm initialized: current node (ev4ocuzk61lj0375z80mkba5f) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join --token SWMTKN-1-4dtk2ieh3rwjd0se5rzwyf2hbk7zlyxh27pbh4plg2sn0qtitx...