一、问题
服务器重启之后systemctl restart docker始终不成功,网上各种方法都试了一遍,依然没有解决问题。
systemctl restart docker 报错信息:
[root@localhost xs-2.0]# systemctl start docker
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
systemctl status docker.service 查看错误信息:
[root@localhost xs-2.0]# systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/etc/systemd/system/docker.service; disabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/docker.service.d
└─docker.conf
Active: failed (Result: exit-code) since Tue 2022-08-16 12:37:33 CST; 36s ago
Docs: https://docs.docker.com
Process: 394313 ExecStart=/usr/bin/dockerd --default-ulimit nofile=65535:65535 -H fd:// (code=exited, status=1/FAILURE)
Main PID: 394313 (code=exited, status=1/FAILURE)
8月 16 12:37:33 localhost.localdomain systemd[1]: docker.service: Service RestartSec=100ms expired, scheduling restart.
8月 16 12:37:33 localhost.localdomain systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
8月 16 12:37:33 localhost.localdomain systemd[1]: Stopped Docker Application Container Engine.
8月 16 12:37:33 localhost.localdomain systemd[1]: docker.service: Start request repeated too quickly.
8月 16 12:37:33 localhost.localdomain systemd[1]: docker.service: Failed with result 'exit-code'.
8月 16 12:37:33 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
journalctl -xe 查看报错详细信息:
[root@localhost xs-2.0]# journalctl -xe
--
-- An ExecStart= process belonging to unit docker.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
8月 16 12:37:32 localhost.localdomain systemd[1]: docker.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The unit docker.service has entered the 'failed' state with result 'exit-code'.
8月 16 12:37:32 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: docker.service 单元已失败
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- docker.service 单元已失败。
--
-- 结果为“failed”。
8月 16 12:37:32 localhost.localdomain audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=docker comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
8月 16 12:37:32 localhost.localdomain auditd[1141]: find kylin-root
8月 16 12:37:32 localhost.localdomain auditd[1141]: AUDIT:bfree=500118,threshold_size=75,fs_space_warning=0
8月 16 12:37:33 localhost.localdomain systemd[1]: docker.service: Service RestartSec=100ms expired, scheduling restart.
8月 16 12:37:33 localhost.localdomain systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Automatic restarting of the unit docker.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
8月 16 12:37:33 localhost.localdomain systemd[1]: Stopped Docker Application Container Engine.
-- Subject: docker.service 单元已结束停止操作
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- docker.service 单元已结束停止操作。
8月 16 12:37:33 localhost.localdomain audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=docker comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
8月 16 12:37:33 localhost.localdomain audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=docker comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
8月 16 12:37:33 localhost.localdomain systemd[1]: docker.service: Start request repeated too quickly.
8月 16 12:37:33 localhost.localdomain systemd[1]: docker.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The unit docker.service has entered the 'failed' state with result 'exit-code'.
8月 16 12:37:33 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: docker.service 单元已失败
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- docker.service 单元已失败。
--
-- 结果为“failed”。
8月 16 12:37:33 localhost.localdomain auditd[1141]: find kylin-root
8月 16 12:37:33 localhost.localdomain auditd[1141]: AUDIT:bfree=500118,threshold_size=75,fs_space_warning=0
8月 16 12:37:33 localhost.localdomain auditd[1141]: find kylin-root
8月 16 12:37:33 localhost.localdomain auditd[1141]: AUDIT:bfree=500118,threshold_size=75,fs_space_warning=0
lines 1895-1950/1950 (END)
vi /var/log/messages 查看日志,shift+G定位到末尾,具体报错信息:
Aug 16 12:37:32 localhost systemd[1]: Starting Docker Application Container Engine...
Aug 16 12:37:32 localhost dockerd[394274]: time="2022-08-16T12:37:32.368689600+08:00" level=info msg="Starting up"
Aug 16 12:37:32 localhost dockerd[394274]: failed to load listeners: no sockets found via socket activation: make sure the service was started by systemd
Aug 16 12:37:32 localhost systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Aug 16 12:37:32 localhost systemd[1]: docker.service: Failed with result 'exit-code'.
Aug 16 12:37:32 localhost systemd[1]: Failed to start Docker Application Container Engine.
Aug 16 12:37:32 localhost audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=docker comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
Aug 16 12:37:32 localhost auditd[1141]: find kylin-root
Aug 16 12:37:32 localhost auditd[1141]: AUDIT:bfree=500118,threshold_size=75,fs_space_warning=0
Aug 16 12:37:32 localhost systemd[1]: docker.service: Service RestartSec=100ms expired, scheduling restart.
Aug 16 12:37:32 localhost systemd[1]: docker.service: Scheduled restart job, restart counter is at 1.
Aug 16 12:37:32 localhost systemd[1]: Stopped Docker Application Container Engine.
Aug 16 12:37:32 localhost audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=docker comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Aug 16 12:37:32 localhost audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=docker comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Aug 16 12:37:32 localhost systemd[1]: Starting Docker Application Container Engine...
Aug 16 12:37:32 localhost dockerd[394298]: time="2022-08-16T12:37:32.602459047+08:00" level=info msg="Starting up"
Aug 16 12:37:32 localhost dockerd[394298]: failed to load listeners: no sockets found via socket activation: make sure the service was started by systemd
Aug 16 12:37:32 localhost systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Aug 16 12:37:32 localhost systemd[1]: docker.service: Failed with result 'exit-code'.
Aug 16 12:37:32 localhost systemd[1]: Failed to start Docker Application Container Engine.
Aug 16 12:37:32 localhost audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=docker comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
Aug 16 12:37:32 localhost systemd[1]: docker.service: Service RestartSec=100ms expired, scheduling restart.
Aug 16 12:37:32 localhost systemd[1]: docker.service: Scheduled restart job, restart counter is at 2.
Aug 16 12:37:32 localhost systemd[1]: Stopped Docker Application Container Engine.
Aug 16 12:37:32 localhost audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=docker comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Aug 16 12:37:32 localhost audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=docker comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Aug 16 12:37:32 localhost auditd[1141]: find kylin-root
Aug 16 12:37:32 localhost auditd[1141]: AUDIT:bfree=500118,threshold_size=75,fs_space_warning=0
Aug 16 12:37:32 localhost auditd[1141]: find kylin-root
Aug 16 12:37:32 localhost auditd[1141]: AUDIT:bfree=500118,threshold_size=75,fs_space_warning=0
Aug 16 12:37:32 localhost systemd[1]: Starting Docker Application Container Engine...
Aug 16 12:37:32 localhost dockerd[394313]: time="2022-08-16T12:37:32.853072407+08:00" level=info msg="Starting up"
Aug 16 12:37:32 localhost dockerd[394313]: failed to load listeners: no sockets found via socket activation: make sure the service was started by systemd
Aug 16 12:37:32 localhost systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Aug 16 12:37:32 localhost systemd[1]: docker.service: Failed with result 'exit-code'.
Aug 16 12:37:32 localhost systemd[1]: Failed to start Docker Application Container Engine.
关键报错信息:
failed to load listeners: no sockets found via socket activation: make sure the service was started by systemd
二、解决
在网上找了各种解决方案,都没有解决问题。
大多都是让修改docker.service文件中的配置,但是很遗憾我的始终不起作用。
后面看到一篇博客说可以覆盖docker.service中的配置,于是尝试自己创建override配置文件,最终成功解决问题。
具体步骤:
vi /etc/systemd/system/docker.service.d/override.conf
如果目录不存在,先手动创建目录
override.conf中输入:文章来源:https://www.toymoban.com/news/detail-509757.html
# Disable flags to dockerd, all settings are done in /etc/docker/daemon.json
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd
systemctl daemon-reload
systemctl restart docker
启动成功文章来源地址https://www.toymoban.com/news/detail-509757.html
到了这里,关于如何覆盖docker.service文件中的配置,解决一次docker.service启动不成功的问题的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!