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
- WHAT IS DOCKER & DOCKER CONTAINER ?
- HOW TO INSTALL DOCKER CE ON CENTOS/RHEL 7/6
- HOW TO INSTALL DOCKER ENGINE ON UBUNTU 19.10/18.04
- WHAT IS DOCKERFILE AND BASICS OF DOCKERFILE
- INSTALLATION OF DOCKER FAILS ON CENTOS 8 WITH ERROR – PACKAGE CONTAINERD.IO-1.2.10-3.2.EL7.X86_64 IS EXCLUDED
- SOME BASIC DOCKER COMMANDS BEGINNER SHOULD KNOW
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 \ docker-engine
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 https://download.docker.com/linux/centos/docker-ce.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 containerd.io
Note: Sometimes might be you get following error while installing Docker.
Installation of Docker fails on CentOS 8 with Error – package containerd.io-1.2.10-3.2.el7.x86_64 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> containerd.io
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
Reference:
Enjoy it!