Jack Wallen demonstrates how easy it is to manage a Docker Swarm deployment with Portainer’s web-based GUI.
I’ve said this many times before, and I’ll say it many more times in the future: Portiner is my favorite container management platform. Portiner allows me to perform any task required to manage and monitor container deployments. I can use Portainer on an isolated docker development machine or a multi-node swarm cluster.
Guard. Did I just say multi-node Swarm Cluster? I did.
If your Docker deployments are large scale in nature, chances are you are dealing with a Docker Swarm. For those who don’t know, Swarm Mode is built into the Docker Engine and allows you to manage a cluster of Docker nodes for increased scalability, decentralized deployments, desired state tunings, multi-host networking, load balancing, and rolling updates.
In other words, if your container deployments need to meet higher requirements, you probably use Docker Swarm. And the good news is you can manage your swarm right from Portiner.
TO SEE: Hiring Kit: Back-end Developer (Tech Republic Premium)
If you haven’t implemented Portiner yet, be sure to check it out How to implement the Portainer container management tool with persistent storage before continuing. Make sure you deploy Portiner on your control node and make sure to use the Agent option when creating a new Docker environment (Image A).
Image A

After you create your new environment, it should appear in your list of environments (Figure B).
Figure B

How to manage your Docker Swarm from Portiner
With your Docker Swarm environment active, select it and you will see the Swarm item in the left sidebar (Figure C).
Figure C

Click on that entry and you will see two sections: Cluster Status and Nodes (Figure D).
Figure D

Let’s take a look at our dockercontroller node. Click on that item to display the details (Digits E).
Digits E

As you can see, there are not many items that you can check. What you can do is set the node’s availability (from Active, Pause, Drain) and add labels, which are metadata that describes the node.
As for availability, here are the descriptions:
- Active: A node is active and available for the scheduler to assign tasks.
- Pause: A node is active, but the scheduler cannot assign new tasks to this node, although existing tasks remain active.
- Drain: A node is running, but the scheduler cannot assign new tasks and will shut down all existing tasks and reassign them to other nodes.
The Availability option is a very convenient way to manage individual nodes. You may need to replace a node. Instead of just stopping it, empty it so that all tasks are reassigned. You can then deploy the new node and set it as active.
Use labels as a convenient method of organizing your swarm. For example, suppose node 1 is an Ubuntu server and node 2 is an AlmaLinux server. Go to the first node (which, for our example, is hosted on Ubuntu Server) and click + Label. In the resulting window, type os for name and Ubuntu Server for value (Figure F).
Figure F

You can add as many labels as you want.
Fix a confusing error
When I first started working with Docker Swarm and Portainer, I discovered a confusing error that took me some time to resolve. When I tried to make a change to a Swarm Node, I got the error:
rpc error: code = Unknown description
Even after restarting every node in the Swarm, I got the same error. On a whim, I checked the time on each server, only to find that node1 and node2 were configured for different time zones. Because of this, the Swarm nodes struggled to communicate with each other. To fix that problem, I logged into the nodes and ran the command:
sudo timedatectl set-timezone ZONE
Where ZONE is the correct time zone for my area which can be found with the command:
cat /etc/timezone
Once you’ve made sure that the time zones for each node are correct, that error should go away and you can label your nodes as needed and set their availability.
Of course you can also scale your implementations within your Swarm with Portiner. To find out how this is done, check out my tutorial Scaling Service Deployments with Portainer.
And that’s all there is to managing your Docker Swarm with Portiner. This platform is a remarkable solution for anyone looking to make managing Docker container deployments a much easier and more efficient process.
Subscribe to TechRepublic’s How to make technology work on YouTube for all the latest technical advice for business professionals from Jack Wallen.