系统相关
首页 > 系统相关> > java – Docker中的JRE内存不足

java – Docker中的JRE内存不足

作者:互联网

我正在尝试建立和sbt 0.13.13码头图像类似于this一个.运行java $JAVA_OPTS -jar sbt-launch.jar(作为构建映像的步骤)失败:

OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000d3026000, 451256320, 0) failed; error='Out of memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 451256320 bytes for committing 
reserved memory.

增加-Xmx没有帮助.我该怎么做才能解决这个问题?这是Dockerfile:https://github.com/kolov/k8s-stuff/blob/master/scala/Dockerfile

解决方法:

使用以下命令增加硬盘的交换空间

sudo dd if=/dev/zero of=/var/myswap bs=1M count=2048

sudo mkswap /var/myswap

sudo swapon /var/myswap

标签:java,docker,docker-machine
来源: https://codeday.me/bug/20190710/1427451.html