Lead Image © Author, 123RF.com

Lead Image © Author, 123RF.com

Scale your Docker containers with Docker Swarm

Extending the Hive

Article from ADMIN 51/2019
If you've experienced the power of a single Docker container, you're in for a treat. Thanks to Docker Swarm, you can scale that container with the help of as many nodes as you need.

Swarm is a clustering and scheduling tool for Docker containers. Not only does it make the clustering of containers possible, it makes it quite easy. Once deployed, that swarm will behave as if it were a single, virtual system.

Why is this important? In a word, redundancy. Should you deploy a single container for a system and that container were to go down, so, too, would follow the system. By making use of Docker Swarm, if one container goes down, the other nodes will pick up the slack. That redundancy is crucial for business uptime.

Installing Docker

Before I get into showing you how to launch a Docker swarm, I'll first install Docker and deploy a single container. I'll be demonstrating by deploying the ever-popular Nginx container on Ubuntu Server 18.04.

To begin, install Docker on Ubuntu Server. I'll be setting up three Ubuntu Server machines: one to serve as the manager and two to serve as nodes. The following steps should take place on all three machines.

Because it's always wise to update and upgrade, you can take care of that first. Remember, however, should the kernel be upgraded in the process, you'll want to reboot the server, so make sure you run the update/upgrade at a time when a reboot is possible.

Log in to Ubuntu Server and issue:

sudo apt-get update
sudo apt-get upgrade -y

Once the upgrade completes, reboot (if necessary). Now you can move on to installing Docker, which is incredibly easy because Docker is found in the standard repositories. From the terminal window, issue the command

sudo apt-get install docker.io -y

which will pick up all the necessary dependencies. When installation finishes, you then need to add your user to the docker group; deploying containers with sudo can lead to security issues, so it's best to run the docker command as a standard

Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus