Java 8 Docker Cgroup Support Backported

TLDR; -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap

Introduced in Java 10, cgroup support has been backported in java 8 (8u212). See also this blog post.

Without this option, a jvm running in docker does not know about the memory allocated for the docker container. It knows the memory of the host instead (TODO : to verify exactly) ands allocates a fraction of it by default.

The consequences : when the memory used by java is higher than the memory available by the host but inferior to the memory affected automatically by the jvm, the containers crashes without Out of memory exception from java.

Written on June 5, 2019
Licence Creative Commons
Ce(tte) œuvre est mise à disposition selon les termes de la Licence Creative Commons Attribution 4.0 International.