blog-image

Jun 20, 2018

18 min read

How to install Docker Swarm in Ubuntu 16.04/CentOS 7

Written by

Vippy The VPS
Docker Swarm is a container orchestration and clustering tool to manage Docker hosts, and is a part of Docker Engine, which was introduced in Docker 1.12. It’s not necessarily the easiest to install, which is why we’ll cover the key steps of how to install Docker Swarm in this tutorial. The primary objective of Docker Swarm is to group multiple Docker hosts into a single logical virtual server—this ensures availability and high performance for your application by distributing it over a number of Docker hosts instead of just one. Docker Swarm has a ton of benefits, like self-healing, load balancing, scaling containers up and down, service discovery, and rolling updates, so it’s worth going through the installation process if you want to combine Docker and high availability.

The “Swarm” concept:

To manage and orchestrate cluster, a swarm is created between one or many Docker engines using swarmkit. You can either create a swarm or join an existing swarm. There are two types of nodes in the cluster—one is the manager node and another is the worker node. A manager node receives a service definition (when you create a service) and dispatches this service/task to a worker node. You can have more than one manager node but there is only one super manager. In a nutshell, the manager node manages the Docker Engine process on all other nodes, and runs containers as well. The worker nodes execute tasks despatched by manager nodes. The agents on worker nodes report the state of the tasks to the manager node to keep the cluster running smoothly. Because of this, you can take one manager node out of the cluster temporarily, perhaps for maintenance, and then promote another worker node as the temporary manager node. In this article, we will go through the step-by-step instructions on how to install Docker Swarm and configure two nodes. The master node is on Ubuntu 16, and worker node is on CentOS 7.

Prerequisites to install Docker Swarm

  • Two VPSs: one running Ubuntu 16.04 and a VPS running or CentOS 7.
  • A non-root, sudo-enabled user. If you only have a root user, see our SSH tutorial for details on creating new users.
[cta_inline]

Notes

  • This tutorial uses variables to represent user-specific configurations, such as server IP addresses, passwords, domain names, and more. Whenever you see one of these variables, you should replace them with your specific details.

Step 1. Configure the manager node

Docker Swarm is a container orchestration and clustering tool to manage Docker hosts, and is a part of Docker Engine, which was introduced in Docker 1.12. It’s not necessarily the easiest to install, which is why we’ll cover the critical steps of how to install Docker Swarm in this tutorial. The primary objective of Docker Swarm is to group multiple Docker hosts into a single logical virtual server—this ensures availability and high performance for your application by distributing it over many Docker hosts instead of just one. Docker Swarm has a ton of benefits, like self-healing, load balancing, scaling containers up and down, service discovery, and rolling updates, so it’s worth going through the installation process if you want to combine Docker and high availability.

The “Swarm” concept:

A swarm is created between or many Docker engines using swarmkit. You can either create a swarm or join an existing swarm. There are two types of nodes in the cluster—one is the manager node, and another is the worker node. A manager node receives a service definition (when you create a service) and dispatches this service/task to a worker node. You can have more than one manager node, but there is only one super manager. In a nutshell, the manager node manages the Docker Engine process on all other nodes and runs containers as well. The worker nodes execute tasks despatched by manager nodes. The agents on worker nodes report the state of the tasks to the manager node to keep the cluster running smoothly. Because of this, you can take one manager node out of the cluster temporarily, perhaps for maintenance, and then promote another worker node as the temporary manager node. In this article, we will go through the step-by-step instructions on configuring two nodes in Docker Swarm cluster. The master node is on Ubuntu 16, and worker node is on CentOS 7.

Prerequisites to install Docker Swarm

  • Two VPSs: one running Ubuntu 16.04 and a VPS running or CentOS 7.
  • A non-root, sudo-enabled user. If you only have a root user, see our
Continue reading this article
by subscribing to our newsletter.
Subscribe now

A note about tutorials: We encourage our users to try out tutorials, but they aren't fully supported by our team—we can't always provide support when things go wrong. Be sure to check which OS and version it was tested with before you proceed.

If you want a fully managed experience, with dedicated support for any application you might want to run, contact us for more information.

Leave a Reply