Memory management in docker

I read the following article Maybe this is of interest for the official docker image. Specifically combined with a memory limit on the container. It’s main point is that the JVM doesn’t know it is running in a container and therefore sets it’s heap size to large. Which may result in the container very quickly run out of memory and it gets killed by docker. The solution is to set xmx value (in JAVA_OPTIONS) in relation to the memory limit you have set for the container. This value can also be calculated while starting up the container. I don’t know if anybody has a problem with this but then this might be a solution.

I don’t think there is any need to change the container. You can pass the xmx option as an environment variable in EXTRA_JAVA_OPTS.

I’ve been running in docker for quite awhile now and I’ve not had that problem yet, but other add-ons might require more memory than the ones I’m using.

This is good information. Thanks for posting!