github.com/portworx/docker@v1.12.1/docs/swarm/swarm-tutorial/create-swarm.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "Create a swarm"
     4  description = "Initialize the swarm"
     5  keywords = ["tutorial, cluster management, swarm mode"]
     6  [menu.main]
     7  identifier="initialize-swarm"
     8  parent="swarm-tutorial"
     9  weight=12
    10  +++
    11  <![end-metadata]-->
    12  
    13  # Create a swarm
    14  
    15  After you complete the [tutorial setup](index.md) steps, you're ready
    16  to create a swarm. Make sure the Docker Engine daemon is started on the host
    17  machines.
    18  
    19  1. Open a terminal and ssh into the machine where you want to run your manager
    20  node. For example, the tutorial uses a machine named `manager1`.
    21  
    22  2. Run the following command to create a new swarm:
    23  
    24      ```bash
    25      docker swarm init --advertise-addr <MANAGER-IP>
    26      ```
    27  
    28      In the tutorial, the following command creates a swarm on the `manager1`
    29      machine:
    30  
    31      ```bash
    32      $ docker swarm init --advertise-addr 192.168.99.100
    33      Swarm initialized: current node (dxn1zf6l61qsb1josjja83ngz) is now a manager.
    34  
    35      To add a worker to this swarm, run the following command:
    36  
    37          docker swarm join \
    38          --token SWMTKN-1-49nj1cmql0jkz5s954yi3oex3nedyz0fb0xx14ie39trti4wxv-8vxv8rssmk743ojnwacrr2e7c \
    39          192.168.99.100:2377
    40  
    41      To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
    42      ```
    43  
    44      The `--advertise-addr` flag configures the manager node to publish its
    45      address as `192.168.99.100`. The other nodes in the swarm must be able
    46      to access the manager at the IP address.
    47  
    48      The output incudes the commands to join new nodes to the swarm. Nodes will
    49      join as managers or workers depending on the value for the `--token`
    50      flag.
    51  
    52  2. Run `docker info` to view the current state of the swarm:
    53  
    54      ```bash
    55      $ docker info
    56  
    57      Containers: 2
    58      Running: 0
    59      Paused: 0
    60      Stopped: 2
    61        ...snip...
    62      Swarm: active
    63        NodeID: dxn1zf6l61qsb1josjja83ngz
    64        Is Manager: true
    65        Managers: 1
    66        Nodes: 1
    67        ...snip...
    68      ```
    69  
    70  3. Run the `docker node ls` command to view information about nodes:
    71  
    72      ```bash
    73      $ docker node ls
    74  
    75      ID                           HOSTNAME  STATUS  AVAILABILITY  MANAGER STATUS
    76      dxn1zf6l61qsb1josjja83ngz *  manager1  Ready   Active        Leader
    77  
    78      ```
    79  
    80      The `*` next to the node id indicates that you're currently connected on
    81      this node.
    82  
    83      Docker Engine swarm mode automatically names the node for the machine host
    84      name. The tutorial covers other columns in later steps.
    85  
    86  ## What's next?
    87  
    88  In the next section of the tutorial, we'll [add two more nodes](add-nodes.md) to
    89  the cluster.