Difficulty: Beginner
Estimated Time: 10 minutes

This scenario introduces Docker Swarm. Swarm makes it easy to manage a cluster of Docker hosts.

The environment has been configured with two clients and two docker hosts. The docker can be access from the client using the hostname docker.

Docker Swarm is deployed via a container on each of the hosts.

This scenario has introduced Docker Swarm, a tool to help manage a cluster of Docker hosts.

To install Swarm locally simply pull the container docker pull swarm

Docker Swarm

Step 1 of 7

Create a Swarm Cluster

To create a group of hosts for Swarm to manage you first need to create a cluster identified by a SwarmID.

Swarm is deployed via a Docker container and the token is created using swarm create.

All Docker hosts will use this token to join to the same cluster. As we'll be using this token in future commands we'll store the result in a variable called $SWARMID.

Execute the command below to create and store the token which will then be displayed on the screen.

SWARMID=$(docker run --rm -ti swarm create); echo $SWARMID

Terminal Host 2