docker-compose启动jenkins后,使用maven插件打包时报错(library initialization failed - unable to allocate file descriptor table - out of memory)
1、错误:在docker运行的jenkins(使用的jdk8插件和maven3)中进行java项目打包时,出现
library initialization failed - unable to allocate file descriptor table - out of memory 错误
2、原因:jenkins的docker-compose.yml文件中未给容器配置ulimit,则从docker守护进程上设置的默认ulimits继承,这个值太大,
我使用的是rocky9.4内核和docker27.4.1,jenking版本是2.492.1
3、我的解决方案:在docker-compose.yml中加上如下限制:
ulimits:
nofile:
soft: 65536 # 设置容器软限制
hard: 65536 # 设置容器硬限制
nproc:
soft: 1024 # 设置进程数软限制
hard: 2048 # 设置进程数硬限制
即可!
4、一劳永逸法:
执行systemctl status docker
查看docker.service文件并且在启动服务中的ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock 后追加 --default-ulimit nofile=65535:65535 即可
systemctl daemon-reload
systemctl restart docker
正文到此结束
- 本文标签: Linux Java
- 本文链接: https://www.kxop.top/article/42
- 版权声明: 本文由王开心原创发布,转载请遵循《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权