Article directory
Preface
Since the Docker versions on my two Linux machines are inconsistent, I want to synchronize the two versions.
Uninstall Docker
Step 1 : Uninstall Docker through rpm command
rpm -qa|grep docker|xargs rpm -ev --allmatches --nodeps
Step 2 : Uninstall Docker-related files
whereis docker |xargs rm -frv
Step 3 : Check if there are any uninstallation residues
whereis docker
Step 4 : Delete images and containers
rm -rf /var/lib/docker
Install Docker
Step 1 : Install the dependencies required by Docker
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Step 2 : Check the downloadable versions of Docker
sudo yum list docker-ce --showduplicates | sort -r
Select the version you want to download. Here I chose version 18.09.2.
Step 3 : Use the following code to install Docker Client and Docker Engine at the same time.
sudo yum install docker-ce-18.09.2-3.el7 docker-ce-cli-18.09.2-3.el7 containerd.io
Display Complete! Indicates installation is complete
Step 4 : Use the docker version to check whether the installation is successful.
It is found that the Docker Server is not displayed normally. The initial suspicion is that the Docker service has not started.
Step 5 : Start Docker
# 查看docker状态
sudo systemctl status docker
# 启动docker状态
sudo systemctl start docker
# 设置docker自启动
sudo systemctl enable docker
Step 6 : Check Docker again
and find that it can be displayed normally. At this point the Docker installation is complete.