Setting heap size in docker containers - can't get it to work

I'm at a loss as to how to configure the heap in docker containers. Nothing seems to work as I'd expect:

Straightforward set to 2GB doesn't work:

$ docker run -it -e "ES_JAVA_OPTS=-Xms2g -Xms2g" docker.elastic.co/elasticsearch/elasticsearch:6.6.0
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Error occurred during initialization of VM
Initial heap size set to a larger value than the maximum heap size

Straightforward set to 512MB doesn't work:

Commenting out the options in the stock jvm.options and setting doesn't work:

How do you do it?

Hi,

All of your commands have the same typo.
Xms Xms

It’s Xms Xmx, else your repeating the same thing twice which makes no sense. And you end up overiding only one of the default setting for heap size.

Further reading:
https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html

I think you also need to bypass the bootstrap check if you want to run it quickly like that in single node mode. That’s unrelated to heap size though.

https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-cli-run-dev-mode

Ah geez, thanks. My more complicated, real-life example didn't have that same duplication, but I'll fix my simple examples to see how that works.

Also, thanks for the tip about development mode.

BTW just realized my links are for the wrong version based your first command.
Do check the right doc, I don’t want to waste your time if something you read in there varies per versions or was updated.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.