Creating a Swarm Cluster

Navigate to the folder docker-deploy/onprem/swarm/manifest-onprem-swarm.
  1. Clients need to prepare swarm cluster. Number of machines in cluster can be determined by the requirement. All the machines should be able to communicate with other in the network. Port 2376, 2377 and 7946 should be open on each hosts for swarm cluster to work.
    Note: Mashery has observed issue with IPv6. It would be recommended to run docker demon on IPv4 on each node. Otherwise, the cluster might not work as expected.
  2. SSH into the machine that you to run as swarm manager.
  3. Start swarm manager on the selected node. Execute the following:
    docker swarm init --advertise-addr <Manager IP> . 
    The will produce an output command (starting with docker swarm join) that needs to be executed on all other worker nodes. Sample command:
    docker swarm init --advertise-addr 10.xxx.xxx.61 
    Output:
    Swarm initialized: current node (1qqfygb5po6r0y8vqjjceu6pj) is now a manager.
    To add a worker to this swarm, run the following command:
    docker swarm join --token SWMTKN-1-5ef0r0rlhqrgw5olehorwrsmn0cz83ygnkfex8lzeixndv4av3-at5f983kuwyyiyko6hls412cu 10.127.135.61:2377
    To add a manager to this swarm, run the following command:
     'docker swarm join-token manager'
    You need to ssh into other nodes and run the docker swarm join command (output of step 4) and advertising node's IP. Use the following command as reference to be executed on other nodes.
    docker swarm join --token <TOKEN> <Manger IP>:2377 --advertise-addr <Node IP>
    Sample command based on above command output.
    Node Command
    docker swarm join --token SWMTKN-1-0xuxeo975vwq2dprcy77loazmyqqqr9muzw29yh0xvopq8398z-3zo8r2hb6o3xw51cyogz3z0k6 10.107.138.60:2377 --advertise-addr 10.107.138.62
    This node joined a swarm as a worker.
  4. Verify that the cluster is created successfully by running the following command on the manager. Status should be ready for all the nodes.

    Do not proceed until all the nodes are in active status.

    Command:
    docker node ls
    Sample output:

  5. Log into the docker registry.
    docker login <registry host> -u <user> -p <password> 
    Example:
    docker login mashbuilder-1.na.tibco.com  -u admin -p <pwd>
    Note: Make sure login is successful before continuing.
  6. If the swarm cluster is created successfully, create an Overlay network "ml5" for the containers networking. Execute the following on manager node:
    docker network create -d overlay --attachable ml5