v8.X Docker image does not accept bin/elasticsearch env variables

Using the existing docker image does not accept positional arguments for Elasticsearch environment variables correctly. The documentation states that we should be able to pass the arguments in with this command

docker run --rm --name es8 --net elastic -p 9200:9200 -p 9300:9300 -it elasticsearch:8.1.2 bin/elasticsearch -Ediscovery.type=single-node -Expack.security.enabled=false

However security is enabled (confirmed via logs) and the server fails to start.

{"@timestamp":"2022-04-14T14:47:25.182Z", "log.level": "INFO", "message":"Security is enabled", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.xpack.security.Security","elasticsearch.node.name":"0e0953f434a9","elasticsearch.cluster.name":"docker-cluster"}
...
ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
bootstrap check failure [1] of [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
ERROR: Elasticsearch did not exit normally - check the logs at /usr/share/elasticsearch/logs/docker-cluster.log

A custom Dockerfile with the environment variables set works and correctly starts with security disabled

FROM elasticsearch:8.1.2
ENV xpack.security.enabled=false discovery.type=single-node

Also, using variable names in the CI tool like this works correctly, but I believe there is still a bug around what documentation states and how the image works.

    ES_SETTING_DISCOVERY_TYPE: "single-node"
    ES_SETTING_XPACK_SECURITY_ENABLED: "false"

What makes you think that this error is about security? Just to be sure that this is the only error, or is there more?

Take a look at Install Elasticsearch with Docker | Elasticsearch Guide [8.1] | Elastic

That error is due to discovery_type not being set to single-node (it's running in production mode). That error doesn't happen when the environment variable is set.

The first item isn't an error, just an INFO log saying "message":"Security is enabled" when it was requested to be disabled. The server is not available on http unless the environment variable is set.

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