How to Install Docker Engine on CentOS/RHEL 8

Docker is a tool that allows you to easily build, test and deploy applications smoothly and quickly using containers. Containers allow a developer to package an application with its dependencies and ship it out as a single package. Docker provides a more efficient and lightweight environment to deploy the application.

Useful Articles

In this tutorial helps you to install Docker on CentOS/RHEL 8.

Step 1: Uninstall Old Versions

If an old version of Docker is installed in your system then please remove it and it’s dependencies before proceeding with the installation.

# dnf remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \

Step 2: Add Docker Repository

Run the following command which will add the Docker repository to your system:

# dnf install -y yum-utils
# yum-config-manager --add-repo

Step 3: Install Docker Engine

Docker engine official repository is now available in your system. Now you can install the Docker using the following command

# dnf install docker-ce docker-ce-cli

Note: Sometimes might be you get following error while installing Docker.

Installation of Docker fails on CentOS 8 with Error – package is excluded

Use following article which will help you to resolve the above error.

Step 4: Install Specific Versions Docker

To install a specific version of Docker Engine, list the available versions in the repo, then select and install:

List and sort the versions available in your repo.

# dnf list docker-ce --showduplicates | sort -r
docker-ce.x86_64 18.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 18.03.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.12.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.12.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.09.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.09.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.3.ce-1.el7 docker-ce-stable
docker-ce.x86_64 17.03.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable

Install a specific version by its fully qualified package name.

# dnf install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING>

Step 5: Start Docker

After, Docker package has been installed, start the docker service and enable it at boot time using the below commands:

# systemctl enable docker
# systemctl start docker

Step 6: Check Docker Version

Run mention command to check the docker version.

# docker version

Step 7: Check Docker Info

Now, you can check some docker info using mention command.

# docker info

Step 8: Verify that Docker

Verify that Docker is installed correctly by running the following command.

# docker run hello-world


Enjoy it!

No Responses

Leave a Reply

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.