基于docker.io版本的docker启动失败解决办法

问题:服务器突然断电,导致服务器关机,重启服务器,发现docker启动不了,会出现以下现象
[root@test ~]# service docker start
Redirecting to /bin/systemctl start docker.service
Job for docker.service failed because the control process exited with error code. See “systemctl status docker.service” and “journalctl -xe” for details.
运行指令:docker pull socketplane/openvswitch出现以下错误
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
错误原因:我估计是由于启动的配置文件出了问题,上网查了很多内容,试了又试不成功。
之后将安装的应用apt-get remove docker docker-engine docker.io把docker镜像删除,在安装镜像后,执行docker指令后又出现:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
的错误。
错误原因:删除了docker.io,还有许多与其docker.io相关联的文件任然存在,删除不测底。
正确的删除方法是:
1第一步:删除镜像
apt-get remove docker docker-engine docker.io
2.第二部:删除与docker镜像相关联的内容
sudo apt-get autoremove --purge docker.io
3.第三步:手动删除docker文件。
sudo rm -rf /etc/docker/
注意:此三个步骤顺序不能颠倒,不能先手动删除docker文件,否则容易出现无法自动删除docker.io镜像以及其关联的内容。
之后就能从新开始安装docker,以及创建容器了。

猜你喜欢

转载自blog.csdn.net/shifengwang123/article/details/90038489