Specific steps:
(Recommended video tutorial:Docker video tutorial)
Uninstall the old version of docker before reinstalling
rpm list installed|grep docker
Or use this command
rpm -qa|grep docker //查看已经安装的docker安装包,列出入校内容 docker.x86_64 2:1.12.6-16.el7.centos @extras docker-client.x86_64 2:1.12.6-16.el7.centos @extras docker-common.x86_64 2:1.12.6-16.el7.centos @extra
Delete respectively
yum -y remove docker.x86_64 yum -y remove docker-client.x86_64 yum -y remove docker-common.x86_64
Delete the docker image
rm -rf /var/lib/docker
Reinstall
yum update //确保yum包最新
yum install -y yum-utils
(recommended related tutorials:docker tutorial)
Check whether there is device-mapper-persistent-data package (rpm -qa|grep device-mapper-persistent-data, if so) There is no need to install it). If it is not installed, execute the command:
yum install -y device-mapper-persistent-data
to check whether there is lvm2 package (rpm -qa|grep lvm2, if there is, there is no need to install it). If it is not installed, execute the command :
yum install -y lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo //注意,以上为设置yum源,从Docker官方地址下载安装包 yum list docker-ce --showduplicates | sort -r //查看仓库中所有的docker版本 yum install docker-ce(默认安装)或 yum install docker-ce-17.12.0.ce(注:17.12.0是版本号,可根据列表选择)
Set docker to automatically start and start services after booting up
[root@localhost softs]# systemctl enable docker [root@localhost softs]# systemctl start docker
The above is the detailed content of How to uninstall and reinstall docker. For more information, please follow other related articles on the PHP Chinese website!