How to install Docker in common Linux distributions?

Table of Contents

Gone are those days when developers had to write programs centering on the target machines where the program or application was to work. Technology like Container allows developers to test, build, and ship the code to any device or machine regardless of its architecture. Sounds like an advanced phase of software development right? For anyone who wishes to practice this technology, we bring you how to install Docker in common Linux distributions.

In today’s post, we are going to check what is Container, the benefits of a Container, what is docker, and how to install Docker in Centos 7, Ubuntu, Rocky, and Alma Linux.

What is Container?

In earlier days, developers used to write codes, build programs and test those in their own environment or in the test servers. When the time comes to deploy the code or program initially built for production servers, it often fails at a glance. There could be many reasons for the failure, for example, lack of necessary service in production, or some under-the-hood reasons. Along with that, another challenge with direct program deployment was that it needed to have high resources as let’s assume you are deploying 3 servers for 3 services in a project then the cost would go high for obvious reasons.

The solution to this challenge is Container. Container term comes from Shipping containers which can be shipped anywhere once placed in the cargo plane or ship. Containers provide the ability for the developers to build, test and deploy the code irrespective of their operating system. With such ability, developers can almost build test, and deploy codes without worrying about it being a failure.

Benefits of Containers

Container technology has benefits, that can help developers in many ways. The nature of containerization is based on isolation, some of the common benefits of Containers are as follow.

  1. Ability to build, test, and ship codes.
  2. Fast, and speedy performance.
  3. Easy management.
  4. Containers have their own package-wise resources.
  5. Easy to spot the error.
  6. Low resource requirement.
  7. Security.

What is Docker

Docker is a technology that helps to create and manage Containers so that developers can fasten the process to code delivery, shipment, etc. This containerization can be achieved through Docker software which is developed by Docker, which is an American technology company. The initial release of Docker is March 20, 2013, and Docker is well-known containerization software present in the market today.

How to install Docker?

Just so you know, Docker is not supported in RHEL 8, and thus Red Hat came up with Podman. You may learn about it here which is native to Linux. We have gone through Containers and Dockers, lets’s check out how you can install Docker in your Local or Production servers to play along with the technology and engineer something.

1) Install Docker in Centos 7

CentOS is one of the most stable and secure productions OS available. Though both 7 and 8 versions are discontinued, still who have better hands-on CentoOS still using it. What if Red Hat doesn’t want to invest,  reasons might be many but you can install Docker in CentOS 7 by the following method.

1–) Update if any and set up the Repository

yum update -y;yum install -y;yum-utils yum-config-manager --add-repo

2–) Install Docker Engine

yum install docker-ce docker-ce-cli docker-buildx-plugin docker-compose-plugin -y /var/log/dockerinstall.log

3–) Start and enable service

systemctl start docker;systemctl enable docker &>> /var/log/startdocker.log

4–) Run Docker

docker run hello-world

2) Install Docker in Ubuntu

A Debian-based Linux distribution Ubuntu has been well-known in the market. Ubuntu is very easy to use and understand which is why it’s so popular. Ubuntu was released on 20 October 2004 by Canonical which is a software company. We are installing docker on Ubuntu Bionic 18.04 (LTS).

You can install ubuntu in the following way.

1–) Update if any

apt-get update

2–) Setup repo

apt-get install 

3–) Add the official GPG key of Docker

curl -fsSL
/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

4–) Set up the repository

"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg]

"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" |
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

5–) Download the GitHub repo

curl -L "
/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

6–) Provide perms

chmod +x /usr/local/bin/docker-compose

7–) Run the docker command

docker run hello-world

3) Install Docker in Rocky 8

A Linux distribution coming straight from Rocky Enterprise Software Foundation, Rocky Linux is getting its spot in the market. Rocky Linux is developed in response to the sad end of the life of centOS which is now upgraded to the centOS stream. We are using Rocky Linux version 8.7 for this tutorial.

Docker can be installed in 3 simple steps in Rocky. Add a Repo, download the docker from the Repo, and start/enable the service.

1–) Create a Repo

dnf config-manager --add-repo

2–) Download the docker from the Repo

dnf -y install docker-ce docker-ce-cli docker-compose-plugin

3–) Start/enable the service

systemctl start docker;systemctl enable docker

Finally, run the famous hello world command to welcome docker.

4) Install Docker in Alma 8

CloudLinux, Inc brings Alma Linux. Alma believes to provide a similar vibe as centOS. This distribution is initially released on 30 March 2021. Alma is considered to be the most stable distro about RHEL.

We are installing Docker in Alma 8 version, the installation steps are very similar to Rocky. Add repo, install, and start service.

1–) Add Repo

dnf config-manager --add-repo=

2–) Install Docker

dnf -y install docker-ce docker-ce-cli

3–) Start/Enable service

systemctl start docker;systemctl enable docker

Note:- Once you have installed Docker on your favorite Linux distribution, please do not forget the post-installation steps here. We are using all the mentioned commands through a root user. If you are trying to install and have sudo access, add sudo before every command you run.


There will always be new ways to solve issues in the field of Software development, how the new technology better adopts it and optimizes existing techniques is what makes that technique a game changer. Developers are always keen to adopt such technologies. This concludes about how to install docker in common Linux distributions! What docker installation method or step has helped you? do let us know in the comments section below. If you need any help or have any suggestions to make, do reach us via the contact page here. Happy Earth Hour!

Pranav Chaudhari
Pranav Chaudhari
I am a tech enthusiast who began a career in the hosting field. I like to help folks with their tech-related concerns and bring the best of it.

One Response

Leave a Reply

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

Send Us A Message

More Posts

This website used cookies to ensure you get the best experience in our website.