出现的原因是因为我在上一篇文章(Linux 的 open file 限制)修改了/etc/systemd/system.conf, 随后在重启后发现 Docker 无法启动, 查看对应日志:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
[root@jh-java ~]# 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. [root@jh-java ~]# systemctl status docker ● docker.service - DockerApplicationContainerEngine Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Fri2020-09-1817:25:33CST; 6min ago Docs: https://docs.docker.com Process: 10174ExecStart=/usr/bin/dockerd (code=exited, status=205/LIMITS) MainPID: 10174 (code=exited, status=205/LIMITS)
Sep1817:25:33 jh-java systemd[1]: StartingDockerApplicationContainerEngine… Sep1817:25:33 jh-java systemd[10174]: Failed at step LIMITS spawning /usr/bin/dockerd: Operation not permitted Sep1817:25:33 jh-java systemd[1]: docker.service: main process exited, code=exited, status=205/LIMITS Sep1817:25:33 jh-java systemd[1]: Failed to start DockerApplicationContainerEngine. Sep1817:25:33 jh-java systemd[1]: Unit docker.service entered failed state. Sep1817:25:33 jh-java systemd[1]: docker.service failed.
在经过查询后得知是因为 open file 限制的问题, 需要修改/lib/systemd/system/<服务名>.service的LimitNOFILE=unlimited为LimitNOFILE=<对应上限>即可解决