FYI, there's -XX:MaxRAM option. I've found it vital to run any java under docker, and wondering why there's no much fame for it in community. Some explanations can be found around https://developers.redhat.com/blog/2017/04/04/openjdk-and-containers/. Note, I haven't ever check ES's startup .sh and don't know whether it controls -XX:MaxRAM at all.