I see in the examples given through the documentation that you can define environment variables like cluster.initial_master_nodes or discovery.seed_host…
How do these variables get handled inside the container? Are they automatically resolved by Elasticsearch or do they need to be appended to the
elasticsearch.yml configuration file through a manual action?
Yes they are added by docker entrypoint
Here to mos important lines:
# Parse Docker env vars to customize Elasticsearch
# e.g. Setting the env var cluster.name=testcluster
# will cause Elasticsearch to be invoked with -Ecluster.name=testcluster
# see https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html#_setting_default_settings
declare -a es_opts
while IFS='=' read -r envvar_key envvar_value
# Elasticsearch settings need to have at least two dot separated lowercase
# words, e.g. `cluster.name`, except for `processors` which we handle
if [[ "$envvar_key" =~ ^[a-z0-9_]+\.[a-z0-9_]+ || "$envvar_key" == "processors" ]]; then
if [[ ! -z $envvar_value ]]; then
done < <(env)
So pay attention to use only valid ES options as environment variables.
Thank you for answering Aparo.
I have 2 questions from here:
1- Where can I find the list of all valid ES options as environment variables?
2- In case the same variable is defined as an environment variable and in the same time in the
elasticsearch.yml file, which one has priority?