Hello I want to install elk on docker, so I followed the official documentation https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html
So when I want to start Elasticsearch in Docker to get the password generated for the elastic user and the enrollment token for enrolling Kibana by executing this command:
docker run --name es01 --net elastic -p 9200:9200 -p 9300:9300 -it docker.elastic.co/elasticsearch/elasticsearch:8.1.2
I get this error:
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
{"@timestamp":"2022-04-14T12:39:58.449Z", "log.level": "INFO", "message":"stopping …", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"Elasticsearch.server","process.thread.name":"Thread-2","log.logger":"org.Elasticsearch.node.Node","Elasticsearch.node.name":"50af9edc5c7d","Elasticsearch.cluster.name":"docker-cluster"}
{"@timestamp":"2022-04-14T12:39:58.512Z", "log.level": "INFO", "message":"stopped", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"Elasticsearch.server","process.thread.name":"Thread-2","log.logger":"org.Elasticsearch.node.Node","Elasticsearch.node.name":"50af9edc5c7d","Elasticsearch.cluster.name":"docker-cluster"}
{"@timestamp":"2022-04-14T12:39:58.513Z", "log.level": "INFO", "message":"closing …", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"Elasticsearch.server","process.thread.name":"Thread-2","log.logger":"org.Elasticsearch.node.Node","Elasticsearch.node.name":"50af9edc5c7d","Elasticsearch.cluster.name":"docker-cluster"}
{"@timestamp":"2022-04-14T12:39:58.531Z", "log.level": "INFO", "message":"closed", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"Elasticsearch.server","process.thread.name":"Thread-2","log.logger":"org.Elasticsearch.node.Node","Elasticsearch.node.name":"50af9edc5c7d","Elasticsearch.cluster.name":"docker-cluster"}
{"@timestamp":"2022-04-14T12:39:58.535Z", "log.level": "INFO", "message":"Native controller process has stopped – no new native processes can be started", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"Elasticsearch.server","process.thread.name":"ml-cpp-log-tail-thread","log.logger":"org.Elasticsearch.xpack.ml.process.NativeController","Elasticsearch.node.name":"50af9edc5c7d","Elasticsearch.cluster.name":"docker-cluster"}
2
Answers
I resolved this problem by runing this command:
grep vm.max_map_count /etc/sysctl.conf vm.max_map_count=262144
I solved this problem with these commands:
For Windows and macOS with Docker Desktop
For Windows with Docker Desktop WSL
And finally, I reinitialized the docker containers.
Documentation