docker.service 无法运行"启动"任务:没有这样的文件或目录



当我使用此脚本在CentOS 7.4上启动docker时:

systemctl start docker.service

显示此错误:

[root@ops001 docker]# systemctl start docker.service
JJob for docker.service failed because a configured resource limit was exceeded. See "systemctl status docker.service" and "journalctl -xe" for details.

然后我用这个命令来检查docker状态:

systemctl status docker.service -l

它显示的是这样的:

[root@ops001 docker]# systemctl status docker.service -l
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Sun 2020-04-12 21:31:35 CST; 3min 17s ago
Docs: https://docs.docker.com
Apr 12 21:31:33 ops001.example.com systemd[1]: docker.service failed to run 'start' task: No such file or directory
Apr 12 21:31:33 ops001.example.com systemd[1]: Failed to start Docker Application Container Engine.
Apr 12 21:31:33 ops001.example.com systemd[1]: Unit docker.service entered failed state.
Apr 12 21:31:33 ops001.example.com systemd[1]: docker.service failed.
Apr 12 21:31:35 ops001.example.com systemd[1]: docker.service holdoff time over, scheduling restart.
Apr 12 21:31:35 ops001.example.com systemd[1]: Stopped Docker Application Container Engine.
Apr 12 21:31:35 ops001.example.com systemd[1]: start request repeated too quickly for docker.service
Apr 12 21:31:35 ops001.example.com systemd[1]: Failed to start Docker Application Container Engine.
Apr 12 21:31:35 ops001.example.com systemd[1]: Unit docker.service entered failed state.
Apr 12 21:31:35 ops001.example.com systemd[1]: docker.service failed.

哪里出了问题?我该怎么做才能让docker工作?

我正在检查docker服务定义文件vim /usr/lib/systemd/system/docker.service:

[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
EnvironmentFile=/run/docker_opts.env
ExecStart=/usr/bin/dockerd $DOCKER_OPTS -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always

使用文件/run/docker_opts.env,但在路径中找不到该文件。因此使用此命令生成文件:

/opt/k8s/bin/mk-docker-opts.sh -d /run/docker_opts.env -c

然后使用此命令启动:

systemctl start docker

工作。

相关内容

  • 没有找到相关文章

最新更新