Docker is available in two editions: Community Edition (CE) and Enterprise Edition (EE). Here, we'll proceed with Docker CE, the Community Edition. To do a clean installation, you must first remove existing Docker installation, if anything found. And then proceed with Docker installation by configuring and updating its RPM repository on our local machine. This is most recommended way of installing Docker on any CentOS Linux operating system. Once the installation is done, you need to verify Docker version to check whether it is properly installed or not.
# Install required system packages.
$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
# Add Docker repository to package manager source list.
$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# Install Docker packages from repository.
$ sudo yum install -y docker-ce docker-ce-cli containerd.io
# Check Docker version.
$ docker --version
# Check status of Docker service.
$ sudo systemctl status docker.service
# Enable Docker service at boot.
$ sudo systemctl enable docker.service