How to Install Docker on CentOS 8 Linux.

Hi hope you are doing well, lets learn about “How to Setup and Install Docker on CentOS 8”, the Docker is the fastest growing technology in the IT market.

Many industries are moving towards docker from the normal EC2 instances. Docker is the container technology.

It is PAAS (Platform as a Service), which uses a OS virtualisation to deliver software in packages called containers.

The containers are the bundle of the packages, library files, and some configuration files. It was first started in 2013 and developed by Docker, Inc.

So lets have the Setup of Docker CE on CentOS 8 Step by Step Guide.

Setup and Install Docker CE on CentOS 8

STEP 1: Update the Repository for the Docker to setup and Install on CentOS 8.

So firstly we will update the repository and update the repo with the dnf command.

$ sudo dnf config-manager --add-repo=

So the above command will add the repo for Docker into CentOS 8.

$ sudo dnf update

dnf update command will update the repository, you might get the error while updating the repositories for dependencies or the conflicts error.

Install Docker on Rocky Linux 8 CentOS
Error while Update.

STEP 2: Setup and Install Docker CE on CentOS 8 via dnf command.

So, if the update was properly done then use “dnf install”, else use with the –allowerasing parameter.

$ sudo dnf install -y docker-ce docker-ce-cli
Install Docker on Rocky Linux 8 CentOS
dnf install for docker CE on CentOS 8

If you will get the error while update then use below command

$ sudo dnf install docker-ce docker-ce-cli --allowerasing -y

Once the docker installation get’s completed , start the services for the docker and enable it after rebooting the System.

$ sudo systemctl start  docker.service
$ sudo systemctl status  docker.service
Install Docker on Rocky Linux 8 CentOS
Check the Docker Status

So we have check the status for docker, and it is active running on the CentOS 8, so enable the service for docker at the time of booting.

$ sudo systemctl enable docker.service

STEP 3: Add the User in Docker Group.

Now lets add user “tastethelinux” into the docker group.

sudo usermod -aG docker $USER

“$USER” is the username tastethelinux, you can use whoami to check the username.

docker --version
Docker version 20.10.8, build 3967b7d

So then check version using docker command without sudo, you will get the version for the docker.

So we have successfully install docker ce on CentOS 8, lets create a Container for the MongoDB.

STEP 4: Test Docker by Pulling Images.

So here we will create a container for MongoDB on docker, let’s use the pull command to pull the MongoDB image first.

Install Docker on Rocky Linux 8 CentOS
docker pull image_name
$ docker pull mongo

So we have pulled the images for mongo from the docker, Once it’s completed you can check the image by using “docker images”.

$ docker images

STEP 5: Run Docker Container in CentOS 8.

Now let’s run the docker container by using docker run command.

$ docker run -d mongo

So we have successfully run the docker container in CentOS 8 for MongoDB, now if we have to verify the container is running or not use “docker ps” command.

$ docker ps 

So we have install Docker CE in CentOS 8, then run the container for MongoDB server on CentOS 8.

If you want to install MongoDB on EC2 instances follow the link. Want to Install Docker in Rocky Linux 8. Thanks to Read the article. Keep Supporting US.

5 Replies to “How to Install Docker on CentOS 8 Linux.

Give your valuable time