脚本之家

电脑版
提示:原网页已由神马搜索转码, 内容由www.jb51.net提供.
您的位置:首页网站技巧服务器云和虚拟化docker→ docker启动报错205/limit

docker启动报错205/limit的解决方案

  更新时间:2024年06月28日 14:51:01  作者:小白的程序员 
Dcoker启动报错经常能看到 205/limit这个错误提示,这是告诉你linux操作系统的文件描述符设置的和Docker的不匹配,或者是设置的比较小了,本文介绍了docker启动报错205/limit的解决方案,需要的朋友可以参考下

背景

Dcoker启动报错经常能看到 205/limit这个错误提示,这是告诉你linux操作系统的文件描述符设置的和Docker的不匹配,或者是设置的比较小了。

解决方案

linux中一切皆文件。例如一个socket都会用一个文件描述符去表示,所以linux系统文件描述符的大小,对系统是至关重要的,例如高并发的时候,如果文件描述符太小,服务器的并发是上不去的。

要解决 205/limit可以使用两种方式。

  • 修改系统文件描述符 vim /etc/sysctl.conf
# sysctl settings are defined through files in 
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/. # To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there. # # For more information, see sysctl.conf(5) and sysctl.d(5).
fs.file-max =6553600 # 这里按照实际情况填写。
fs.nr_open = 6553600

修改文件使用执行命令sysctl -p命令让设置的内容生效,并重启docker systemctl restart docker

  • 修改Docker的docker.service文件路径/usr/lib/systemd/system/docker.service文件中对文件描述符的配置,可以修改的比系统配置的最大文件描述符小一些
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
BindsTo=containerd.service
After=network-online.target firewalld.service containerd.service
Wants=network-online.target
Requires=docker.socket
[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
ExecStart=/usr/bin/dockerd --exec-opt=native.cgroupdriver=cgroupfs --log-level=warn --log-opt max-size=50M --storage-driver=overlay2 -H fd:// --containerd=/run/containerd/containerd.sock -H unix:///var/run/docker.sock -H tcp://0.0.0.0:900 --data-root=/data1/docker_customized
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
# Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.
# Both the old, and new location are accepted by systemd 229 and up, so using the old location
# to make them work for either version of systemd.
StartLimitBurst=3
# Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230.
# Both the old, and new name are accepted by systemd 230 and up, so using the old name to make
# this option work for either version of systemd.
StartLimitInterval=60s
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=6553500 # 修改这里
LimitNPROC=infinity
LimitCORE=infinity
# Comment TasksMax if your systemd version does not supports it.
# Only systemd 226 and above support this option.
TasksMax=infinity
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
[Install]
WantedBy=multi-user.target

修改完Docker后,可能还需要修改containerd的启动配置文件, 文件路径/usr/lib/systemd/system/containerd.service

[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target
[Service]
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/bin/containerd
KillMode=process
Delegate=yes
LimitNOFILE=6553500 # 修改这里
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
[Install]
WantedBy=multi-user.target

修改文件后先执行 systemctl daemon-reload 然后执行 systemctl restart docker docker 正常启动。

以上就是docker启动报错205/limit的解决方案的详细内容,更多关于docker启动报错205/limit的资料请关注脚本之家其它相关文章!

相关文章

    • 这篇文章主要介绍了mac docker如何修改daemon.json文件问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教
      2023-08-08
    • 这篇文章主要介绍了Docker 安装Jenkins 踩坑全指南,本文通过图文示例相结合给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
      2022-02-02
    • 这篇文章主要介绍了如何在Linux系统中安装Docker,其实安装docker真的很简单,只需要几条命令就可以完成了,本文给大家介绍的非常详细,需要的朋友可以参考下
      2021-12-12
    • 本篇文章主要介绍了如何解决Linux系统下Docker占满分区的问题。小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
      2017-07-07
    • 这篇文章主要介绍了解决docker安装完成报:bridge-nf-call-iptables is disabled问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
      2020-11-11
    • 这篇文章主要介绍了Docker 教程之数据管理详细介绍的相关资料,需要的朋友可以参考下
      2017-01-01
    • 这篇文章主要介绍了docker-compose创建网桥,添加子网,删除网卡的实现方式,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
      2021-03-03
    • 今天小编就为大家分享一篇关于阿里云esc服务器Docker部署单节点Mysql的讲解,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧
      2019-03-03
    • 这篇文章主要介绍了docker-compose网络配置- IP 主机名 hosts配置方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教
      2024-01-01
    • Dockerfile 是一个用来构建镜像的文本文件,文本内容包含了一条条构建镜像所需的指令和说明,这篇文章主要介绍了Docker 镜像构建保姆级入门实战指南,需要的朋友可以参考下
      2022-09-09

    最新评论