安装Docker启动时报错docker. service:Failed at step LIMITS spawning /usr/bin/dockerd:Operation not permitted

今天在重启docker程序的时候一直启动不起来,通过systemctl status docker和jourctl -xu docker也没有发现什么有用的报错信息,无奈只好查看/var/log/message,发现以下错误提示:

Started containerd container runtime
Starting Docker Application Container Engine...
Failed at step LIMITS spawning /usr/bin/containerd: Operation not permitted
containerd.service: main process exited, code=exited, status=205/LIMITS
Unit containerd.service entered failed state.
containerd.service failed.

其中最为关键的信息是
Failed at step LIMITS和status=205/LIMITS,两个Limits信息

解决过程
看到有limits报错提示,本身的想到是不是系统ulimits和sysctl.conf里面的最大打开文件数是不是不够,查看以下信息:

ulimit -n
65535
sysctl -a|grep fs.nr_open
fs.nr_open = 65535

发现这两处都已经配置了,再查看一下当年已经打开的文件数

lsof -Ki|wc -l
14138

发现打开的文件数也没有超过系统设置的上限
百度搜索网友的解答说是docker.service、containerd.service里面有一项配置不能超过系统的配置
1、修改 /usr/lib/systemd/system/docker.service

LimitNOFILE、 LimitNPROC、LimitCORE这三个选项的值都改成65535

LimitNOFILE=65535
LimitNPROC=65535
LimitCORE=65535

2、修改/usr/lib/systemd/system/containerd.service
将LimitNOFILE、 LimitNPROC、LimitCORE、TasksMax这三个选项的值都改成65535

LimitNOFILE=65535
LimitNPROC=65535
LimitCORE=65535
TasksMax=65535

然后重新加载systemd配置再重启docker就可以了

systemctl daemon-reload
systemctl restart docker

猜你喜欢

转载自blog.csdn.net/yyongsheng/article/details/132490030