REDHAT7.2解决docker启动失败问题

时间:2022-08-10 16:49:51

问题:

[root@localhost ~]# service docker restart
Redirecting to /bin/systemctl restart docker.service
Job for docker.service failed because start of the service was attempted too often. See "systemctl status docker.service" and "journalctl -xe" for details.

然后查看日志内容如下:

-- Unit docker.service has begun starting up.
 9月 20 15:23:49 localhost.localdomain dockerd[2591]: unable to configure the Docker daemon with file /etc/docker/daemon.json: unexpected EOF
 9月 20 15:23:49 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
 9月 20 15:23:49 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
 9月 20 15:23:49 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
 9月 20 15:23:49 localhost.localdomain systemd[1]: docker.service failed.
 9月 20 15:23:49 localhost.localdomain systemd[1]: docker.service holdoff time over, scheduling restart.
 9月 20 15:23:49 localhost.localdomain systemd[1]: start request repeated too quickly for docker.service
 9月 20 15:23:49 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
 9月 20 15:23:49 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
 9月 20 15:23:49 localhost.localdomain systemd[1]: docker.service failed.

  解决办法:

vim /etc/docker/daemon.json

  { "storage-driver": "devicemapper" }

  上面内容写入到这个文件,重启docker服务器,问题解决!!