JRE在Docker中内存不足

时间:2017-07-16 13:46:54

标签: java docker docker-machine

我正在尝试构建并支持类似于this的0.13.13泊坞窗图像。运行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

1 个答案:

答案 0 :(得分:0)

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

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

sudo mkswap /var/myswap

sudo swapon /var/myswap