How To Install Docker On CentOS 8/RHEL 8

Docker is a tool that allows you to easily build, test and deploy applications smoothly and quickly using containers. It has gained widespread popularity in recent times due to the portability to run applications anywhere irrespective of the host operating system. Docker provides a more efficient and lightweight environment to deploy the application. All containers are run by a single operating system kernel and therefore use fewer resources than virtual machines.

In this post, we will learn how to install Docker on CentOS 8 / RHEL 8.

Install Docker On CentOS 8 / RHEL 8

Docker is available in 2 versions:

  • Community Edition (CE)

In this article, we will install the community edition.

let’s get started

Configure Docker Repository

Let’s configure the yum repository.

https://download.docker.com/linux/centos/7/x86_64/stable/

Install Docker

yum install docker-ce --nobest

By using the — nobest option, changes the behavior of the yum package manager so it looks for the first version of docker-ce with satisfiable dependencies.

Start and enable Docker service

Enable because after boot we don't need to start it again.

systemctl start docker

Docker service status

systemctl status docker

Verify

docker run command creates and starts the container -it is to get an interactive[-i] terminal[-t].

To get network Connectivity Inside the docker container run the following commands in the host operating system and restart the docker service.

firewall-cmd --zone=public --add-masquerade --permanent
firewall-cmd --zone=public --add-port=80/tcp
firewall-cmd --zone=public --add-port=443/tcp
firewall-cmd --reload
systemctl restart docker.

And we are done. congratulation we have successfully installed docker🤩.

Thank you for reading!!😇😇

Aspiring Cloud DevOps Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store