解决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插图

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

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

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

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

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

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

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

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

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

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

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

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

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

希望对你有所帮助~

原文链接:https://blog.csdn.net/Along_168163/article/details/124118833?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522171836840916800182116382%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=171836840916800182116382&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-6-124118833-null-null.nonecase&utm_term=docker%E3%80%81%E5%A5%BD%E7%94%A8

© 版权声明
THE END
喜欢就支持一下吧
点赞8 分享