When start the Elasticsearch in a Docker container in Linux instance generated an error below,


​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 /opt/sonarqube/logs/sonarqube.log


Let us see why the above error is generated in a Docker container which contains Elasticsearch,

The Elasticsearch use a mmapfs directory to store its indices. By default in a Linux operating system limits on mmap counts to be very low, which may result in  out of memory. That's the reason we have received the output on the docker container logs. 

Lets increase the limits max_map_count count in your Linux machine by running the following command as root user:

# sysctl -w vm.max_map_count=262144


Also, can set the above value permanently, add the same value in /et/sysctl.conf file. Open a file and use any editor, likely vim/vi/nano,

# vim /et/sysctl.conf

update the value,

vm.max_map_count=262144

The RPM and Debian packages will configure this setting automatically. No further configuration is required.

then, start the Elasticsearch docker container,

$ docker container start elasticsearch