TNS
VOXPOP
Will real-time data processing replace batch processing?
At Confluent's user conference, Kafka co-creator Jay Kreps argued that stream processing would eventually supplant traditional methods of batch processing altogether.
Absolutely: Businesses operate in real-time and are looking to move their IT systems to real-time capabilities.
0%
Eventually: Enterprises will adopt technology slowly, so batch processing will be around for several more years.
0%
No way: Stream processing is a niche, and there will always be cases where batch processing is the only option.
0%
Cloud Native Ecosystem / Containers / Operations

Deploy a Docker Swarm on Rocky Linux

If Docker is your preferred container deployment tool, you'll be happy to know that it's possible to not only install Docker on Rocky Linux but to also deploy a full-blown Docker Swarm on the platform.
Jul 22nd, 2023 6:00am by
Featued image for: Deploy a Docker Swarm on Rocky Linux
Image by Kirill from Pixabay.

You may have heard recently that Red Hat has, in my opinion, gone against the heart and soul of open source. If you’ve not heard, essentially it is putting up a paywall such that every clone of RHEL cannot access the source without paying up. Because of that, many users are migrating to alternatives, such as Rocky Linux.

But as with RHEL, Rocky Linux defaults to Podman as its default container runtime engine. If you’ve been using Docker for years, Podman is a good option but it’s not exactly a 1:1 migration. And so, if Docker is your preferred container deployment tool, you’ll be happy to know that it’s possible to not only install Docker on Rocky Linux but to also deploy a full-blown Docker Swarm on the platform. Even better, you can install Docker on Rocky Linux without removing Podman, so you can enjoy the best of both worlds.

I’m going to show you how to do exactly that. Once complete, you’ll feel right at home deploying and managing Docker containers on this Red Hat Enterprise Linux clone that continues to honor the spirit of open source.

What You’ll Need

To deploy a Docker Swarm on Rocky Linux you’ll need at least two running instances of the open source operating system and a user with sudo privileges. That’s it. Let’s make this happen.

Install the Necessary Dependency

The first thing we’re going to do is install the necessary dependency. This is done on all instances of Rocky Linux. Log into the first instance and run the command for the first dependencies like so:


When that installation completes, you’re ready to move on to the Docker installation.

Install Docker

Again, this is done on all instances of Rocky Linux.

Add the required repository with the command:


Once you’ve added the repository, you can then run the command to install everything necessary for Docker Swarm. That command is:


With Docker installed, you’ll want to start and enable the service with the command:


Finally, add your user to the docker group with:


Log out and log back in for the changes to take effect.

Open the Firewall

Before we deploy Docker Swarm, we must first open a few ports in the firewall, which is achieved with the following commands (run on all instances of Rocky Linux):


Reload the firewall with the command:

Initialize the Swarm

With all of that out of the way, we can now initialize the Swarm. This is done on the machine that will serve as your controller. You will be required to know the IP address of your Swarm manager before you run this command. For example’s sake, let’s say the IP address of our Swarm manager is 192.168.1.192. Go back to that machine and issue the command:


The output of the above command will include the command you must run on all Docker nodes that will join the Swarm. That command will look like this:


Of course, the random string of characters and IP address will be different for your instance.

Copy that command and run it on the first node that will join your Swarm.

Upon successfully joining the Swarm, the output of the command will include:

This node joined a swarm as a worker.

Testing the Node

You can verify the connection by going back to the controller and issuing the command:


Within the output of the command, you should see a section that looks something like this:


As you can see, the swarm is active and there are currently two nodes attached. You can then add more nodes by first running the init command again, copying the command in the output, and running it on the next node. Every time you add a new node, you must run the init command to get a unique join command for the new node.

Another simple test is to deploy a service to the new Docker Swarm. Let’s deploy a simple NGINX service with the command:


That command should successfully deploy an NGINX service to a single node. If you want to deploy the service to 2 nodes, the command would be:


For 3 nodes, the command would be something like this:


If you’ve already deployed the single node service, you can scale it to however many nodes you need with a simple command. Let’s say you have five nodes joined to your Swarm. To scale that service to five, the command would be:


Congratulations, you’ve just deployed your first Docker Swarm on Rocky Linux.

Group Created with Sketch.
TNS owner Insight Partners is an investor in: Docker.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.