There are times that you might have faced some issue with docker repository addition into yum repositories especially when you are behind proxy. If you are facing facing the same problem then below steps would help you install Docker with ease.
Basically docker installation needs 4 components that is containerd.io , docker ce, docker ce cli and docker ce rootless extras.You need to download all of these files into a location and can use the yum to install all of them, below command will let you do the same.
Note: The docker files are for RHEL 7, if you are trying for RHEL 8 please modify the URLs accordingly.
#First Create a separate folder to store the rpm files
mkdir docker
#Now change directory to the new folder
cd docker
#Now using wget, download the rpm files
sudo wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.4.3-3.1.el7.x86_64.rpm
sudo wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-20.10.1-3.el7.x86_64.rpm
sudo wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-cli-20.10.1-3.el7.x86_64.rpm
sudo wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-rootless-extras-20.10.0-3.el7.x86_64.rpm
#Now run the below command, the *.rpm will automatically allign the 4 files as per the need and installs them.
sudo yum install -y *.rpm
#once successfully installed , start your docker service.
sudo systemctl start docker.service
To enable docker as a startup service run the below command
sudo systemctl enable docker.service