容器启动时报错:Cannot create GC thread. Out of system resources.

文章描述了在将Java程序的基础镜像从Ubuntu18.04升级到Ubuntu22.04后,程序在业主环境的Docker容器中因内存不足无法启动。通过日志分析,可能的原因是Docker旧版本与新Ubuntu版本的兼容性问题。解决方案是升级业主环境的Docker版本,问题得到解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

背景

容器内运行的是Java程序,基础镜像从ubuntu18.04升级到ubuntu22.04,在公司环境部署可以正常启动,但是部署到业主环境,无法正常启动。通过docker logs 查看,报错信息如下:

There is insufficient memory for the Java Runtime Environment to continue.
Cannot create GC thread. Out of system resources.
 
The error accompanies the following information:
 
Possible reasons: The system is out of physical RAM or swap space The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap.
 
Possible solutions:
 
Reduce memory load on the system
Increase physical memory or swap space
Check if swap backing store is full
Decrease Java heap size (-Xmx/-Xms)
Decrease number of Java threads
Decrease Java thread stack sizes (-Xss)
Set larger code cache with -XX:ReservedCodeCacheSize=

解决方案:

通过比较两边的宿主机环境,发现docker的版本存在差异。公司环境的版本为:20.10.12 ,而业主环境的docker版本为:20.10.0.

再进一步通过搜索,确定为docker老版本对ubuntu22.04的兼容性问题, stackoverflow上已经有人提出相似问题。docker - Container Fails to Start: Insufficient memory for the Java Runtime Environment to continue - Stack Overflow

因此,果断升级业主的docker版本,即解决了问题。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值