How to install Docker ce on Centos 8 or RHEL 8 Linux

- Advertisment -
- Advertisement -

Installation Docker on CentOS 8 Linux / Stream or RHEL 8 is simple and same as before we were doing on CentOS 7.5. Docker is available in two editions community and enterprises. Here we let you know to install Docker community edition which includes Docker Engine, Docker Command line and Docker Compose.

So, let’s get started with the tutorial:

Step 1: Open Command Terminal and login as root.

For that simply type:

su

And when it asks for the root password given that.

Step 2: Install some required packages for the Docker installation

Device-mapper-persistent-data and lvm2 are required by the device-mapper storage driver, while yum-utils provides yum-config-manager to set repository using a single command.

yum install -y yum-utils device-mapper-persistent-data lvm2

Step 3: Add Docker repository to CentSO 8 or RHEL 8

To download and install the Docker’s latest version of the CentOS 8 or Stream, we will use the Yum config manager to configure the Docker repo, so that our system can recognize the location from where to fetch the RMP packages.

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

or

dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

Step 4: Run System update command

After enabling the Docker repo, run the system update command to flush the cache. For that type:

dnf update

or

yum update

Step 5: Command to instal Docker community edition on CentOS 8

Finally, everything has been set up and its time to install Docker engine on our server with CLI and Compose components.

yum install docker-ce

or

dnf install docker-ce

In the case above command give an error:

[root@localhost ~]# dnf install docker-ce docker-ce-cli containerd.io
Last metadata expiration check: 0:00:50 ago on Wed 02 Oct 2019 08:09:04 AM EDT.
Error:
Problem: package docker-ce-3:19.03.2-3.el7.x86_64 requires containerd.io >= 1.2.2-3, but none of the providers can be installed
- cannot install the best candidate for the job
- package containerd.io-1.2.2-3.3.el7.x86_64 is excluded
- package containerd.io-1.2.2-3.el7.x86_64 is excluded
- package containerd.io-1.2.4-3.1.el7.x86_64 is excluded
- package containerd.io-1.2.5-3.1.el7.x86_64 is excluded
- package containerd.io-1.2.6-3.3.el7.x86_64 is excluded
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

So, we are getting an error because the dnf trying to find the latest upgrade packages even if the dependencies do not support it. Thus we use –nobest flag to cure this problem.

Thus the command will be 

dnf install --nobest docker-ce

Step 6: Enable Docker System Service (daemon)

Here is the command to make the Docker service as a system so that it can start automatically with system boot up.

 systemctl enable docker

Step 7: Start Docker service

Now, finally, we start the docker service to start working around with it.

 systemctl start docker
Enable and run docker service on CentOS 8

Step 8: Verify that Docker Engine working perfectly

Let’s fetch the hello-world image to test the Docker working. However, we directly command the Docker to run hello-world image which it will not find on our local system and pull automatically from the Docker hub.

docker run hello-word
testing docker running on CenTOS stream

Step 9: Pull some Linux distro image

Just to give you an idea, how we can run different Linux operating system on CentOS 8 installed Docker. Hence, here we will pull the latest Ubuntu image. For that, the command is

docker pull ubuntu

By default it uses the latest tag, means it fetches the latest stable version of the Ubuntu.

After downloading it run to use the Ubuntu on CentOS 8 virtually using Docker

docker run -it ubuntu

For more images, you can visit Docker Hub

H2S Media Team
H2S is a group of tech enthusiasts those are passionate about latest technology developments. They always like to solve own technical problems and share the same solution with others through this Website.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Latest Posts

How to enable Virtualbox nested VTX/Amd-V

Do you want to run Virtual machine inside a Virtual Box VM then you have to enable the nested...

UBON introduces SP-6850 Portable speaker priced at INR 1,799/-

UBON electronic brand recently has announced a new portable speaker UBON SP-6850 ‘Entertainment Box’ with in-built radio connectivity along...

Top 10 podcast apps that you should download on your Android

Video-on-demand platforms like Netflix, Prime Video, Hulu are pretty popular among users, and I don't think I need to...

9 Best Indian Movies Games Available on the Google Play store

Most of the Indians are crazy about two things, Bollywood and cricket. We can see that most of the...
- Advertisement -

How and Where to Find All 20 Bobbleheads in Fallout 4

Fallout 4 was released in 2015, but as an ever-green role-playing game, it is still a hugely played game...

How to Obtain the Bastion Exotic Fusion Rifle in Destiny 2

Among the Destiny 2 players, there is a big question about the unlockable Exotic Fusion Rifle. In this article,...

- Advertisment -
- Advertisement -

You might also likeRELATED
Recommended to you