我正在尝试构建和sbt 0.13.13类似于this的docker镜像。运行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中的JRE内存不足,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/45129299/

10-16 05:51