I'm trying to run Elasticsearch using docker compose but I'm not sure how to correctly pass the ES_JAVA_OPTS="-Xms512m -Xmx512m"
environmental variable. I've tried lots of combinations of single and double quotes but they all result in: Error: Could not find or load main class "-Xms512m
.
My docker-compose config is:
elasticsearch:
image: "docker.elastic.co/elasticsearch/elasticsearch:5.4.3"
ports:
- "6379:6379"
environment:
- "http.host=0.0.0.0"
- "transport.host=127.0.0.1"
- "xpack.security.enabled=false"
- 'ES_JAVA_OPTS="-Xms512m -Xmx512m"'
This environmental variable works just fine when running the container directly with:
docker run --detach \
--name elasticsearch \
--publish 9200:9200 \
--env "http.host=0.0.0.0" \
--env "transport.host=127.0.0.1" \
--env "xpack.security.enabled=false" \
--env "ES_JAVA_OPTS=""-Xms512m -Xmx512m""" \
docker.elastic.co/elasticsearch/elasticsearch:5.4.3
What am I missing here?
According to https://github.com/docker/compose/issues/2854, it's an issue with how docker compose will parse your env variables.
If you switch to yaml map instead of list, it should work:
elasticsearch:
image: "docker.elastic.co/elasticsearch/elasticsearch:5.4.3"
ports:
- "6379:6379"
environment:
http.host: 0.0.0.0
transport.host: 127.0.0.1
xpack.security.enabled: "false"
ES_JAVA_OPTS: -Xms512m -Xmx512m
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With