解决docker报错Job for docker.service failed because start of the service was attempted too often

docker安装之后重新安装报错如下:

Job for docker.service failed because start of the service was attempted too often. See "systemctl status docker.service" and "journalctl -xe" for details. To force a start use "systemctl reset-failed docker.service" followed by "systemctl start docker.service" again.

解决办法:直接把配置文件名称修改一下即可。

1.首先切换为root用户,输入su root,再输入密码即可。

解决docker报错Job for docker.service failed because start of the service was attempted too often_第1张图片

2.进入目录下修改配置文件名称,路径:cd /etc/docker/

 解决docker报错Job for docker.service failed because start of the service was attempted too often_第2张图片

 3.查看当前目录的配置文件,输入:ls

解决docker报错Job for docker.service failed because start of the service was attempted too often_第3张图片

 4.把daemon.json配置文件改成daemon.conf即可,命令:mv daemon.json daemon.conf。

然后再输入ll,看看有没有修改过来了。

 5.重新启动服务,命令:sudo service docker restart

6.然后再docker ps, 运行ok了。

 如果上述方法还是不行的话,建议卸载了重新再安装一遍。

1.卸载老版本docker

较旧版本的Docker被称为docker或docker-engine.请卸载它们以及相关的依赖项

$ sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux  docker-engine

$ sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine

2.安装 docker

安装所需的包

yum-utils提供了yum-config-manager 效用,并device-mapper-persistent-data和lvm2由需要 devicemapper存储驱动程序

$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2

3.安装最新版本的Docker CE

sudo yum install docker-ce

sudo yum install docker-ce

4.启动docker

sudo systemctl start docker

sudo systemctl start docker

希望对你有所帮助~

你可能感兴趣的:(docker,docker)