Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JRE out of memory in Docker

A am trying to build and sbt 0.13.13 docker image similar to this one. Running java $JAVA_OPTS -jar sbt-launch.jar (as a step of building the image) fails with:

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.

Increasing -Xmx doesn' help. What can I do to fix this? This is the Dockerfile: https://github.com/kolov/k8s-stuff/blob/master/scala/Dockerfile

like image 534
Assen Kolov Avatar asked Jul 16 '17 13:07

Assen Kolov


1 Answers

Increase the swap space of the hardisk using the following commands

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

sudo mkswap /var/myswap

sudo swapon /var/myswap
like image 83
ramnar Avatar answered Oct 01 '22 15:10

ramnar