Description
I was directed to this repo in elastic/elasticsearch-docker#241
Feature Description
Remove excess Java memory options to make compatible with modern Docker + Java workflow
https://github.com/elastic/elasticsearch-docker/blob/master/.tedi/template/docker-compose.yml.j2#L53
could instead be -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap
if you use supporting JVM with container support.
Alternatively -XX:+UnlockDiagnosticVMOptions
promises to also adjust CPU to respect cgroup / isolation environments, and appears from docker-library/openjdk#245 that OpenJDK official docker images support the backport to Java 8
The TLDR is that this tells docker to use the container, not host config to set sane limits.
Oracle docs here https://blogs.oracle.com/java-platform-group/java-se-support-for-docker-cpu-and-memory-limits
Blog post https://royvanrijn.com/blog/2018/05/java-and-docker-memory-limits/
Happy to PR & run some tests if you're up for one.