linux以及docker修改文件描述符

1.修改linux系统的文件描述符大小

#临时生效

ulimit -n 65535

2.修改 /etc/security/limits.conf 文件

#添加以下配置,永久生效

  • soft nofile 65535
  • hard nofile 65535

3.编辑docker的文件描述符

vim /etc/systemd/system/docker.service

出现如下代码,修改LimitNOFILE,LimitNPROC和LimitCORE为65536

Unit

Description=Docker Application Container Engine

Documentation=https://docs.docker.com

After=network-online.target firewalld.service

Wants=network-online.target

Service

Type=notify

ExecStart=/usr/bin/dockerd --data-root=/home/smartcm/docker/datadir

ExecReload=/bin/kill -s HUP $MAINPID

TimeoutSec=0

RestartSec=2

ExecStartPost=/usr/sbin/iptables -P FORWARD ACCEPT

Restart=always

TimeoutStartSec=0

LimitNOFILE=65536

LimitNPROC=65536

LimitCORE=65536

Delegate=yes

KillMode=process

StartLimitBurst=3

StartLimitInterval=60s

Install

WantedBy=multi-user.target

4.重启docker, 使配置生效

systemctl daemon-reload

systemctl restart docker.service

相关推荐
辉的技术笔记16 分钟前
Dify 自部署为什么跑不动?6 层瓶颈诊断法教你定位
docker
orion5716 小时前
Missing Semester Class1:course overview and introduction of shell
linux
SkyWalking中文站20 小时前
认识 Horizon UI · 6/17:Trace 探索器
运维·监控·自动化运维
程序员老赵1 天前
Docker 部署 Redmine:老牌开源项目管理部署实测记录
docker·开源·团队管理
用户120487221611 天前
Linux驱动编译与加载
linux·嵌入式
程序员老赵1 天前
服务器文件不想 SFTP 上传?Docker 跑个 File Browser,浏览器就能管理
服务器·docker·开源
火车叼位1 天前
写给初级开发者:SSL、SSH、HTTPS 与证书体系全解析
运维
用户805533698031 天前
Input 子系统架构:Core、Handler、Driver 三层是怎么协作的
linux·嵌入式
用户805533698031 天前
RK-Forge外设系列开篇 - 把板子从「能启动」变成「能用」:Ethernet/SPI/MMC 三个纯接线外设
linux·github·嵌入式
小猿姐1 天前
唯品会大规模数据库云原生实践:基于 KubeBlocks 管理数千实例的统一运维之路
运维·elasticsearch·云原生