Docker Swarm in Docker 1.12

By | June 26, 2016

Having set up my virtual laboratory, I thought I’d take Docker Swarm for a test. After having fiddled around a bit with the old (pre Docker 1.12) way of setting up Docker Swarm, I stumbled upon the documentation for Docker Swarm for Docker 1.12 and later.
In version 1.12, which at the time of writing this only exists as a release candidate, Docker Swarm has been incorporated into the Docker Engine and the Docker Swarm image is no longer needed.

In addition, the documentation has also greatly improved! All in all the new Docker Swarm seems, as far as I am concerned, a large improvement.
Since the tutorial is very good, I do not feel the need to write anything in that area. I will however write a few words on setting up the new Docker Swarm in my virtual laboratory. Please read all the instructions before doing anything!

  • Start up the virtual laboratory.
    I’ll start my virtual laboratory in headless mode and then open four terminal windows in which I log in to the different nodes.
  • Start a root shell on each of the nodes.
  • Check which version of the Docker Engine you are running (remember to check all nodes):

    If you are on Docker 1.12 or later, ignore the rest of this step.
    If Docker 1.12 has been released when you read this, update Docker on all nodes. You can try this step if you don’t know whether Docker 1.12 has been released.

    If Docker 1.12 has not yet been released, you need to uninstall the current Docker Engine and install the latest release candidate.
  • Select a port on which the Docker Swam management API will be exposed.
    To make it simple, I choose the same port as in the Docker Swarm tutorial, that is 2377.
  • Start the Docker Swam manager.
    I start my manager on the laboratory1 node that has the IP 192.168.1.180.
  • Start Docker Swarm agents on the three other nodes.
    The three other nodes in my case are laboratory2, laboratory3 and laboratory4. The IP addresses of the agent nodes are not important.
  • Verify that the Swarm is in the desired state.
    On the manager node, laboratory1 in my case, run the following command:

    The result should look something like this:

Nice and simple!

You are now ready to go on to the Docker Swarm tutorial!

Happy coding!

Leave a Reply

Your email address will not be published. Required fields are marked *