How to fix 'elasticsearch exited with code 78'

Problem:

You want to run ElasticSearch using docker, but the container immediately stops again using this error message

es_exited_code78.txt
elasticsearch exited with code 78

or

es_exited_code78_instance.txt
elasticsearch2 exited with code 78

Solution

If you look through the entire log message, you’ll find lines like

es_max_map_count_error.txt
elasticsearch     | [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

Therefore we need to increase the vm.max_map_count limit:

set_vm_max_map_count.sh
sudo sysctl -w vm.max_map_count=524288

Now we need to edit /etc/sysctl.conf so the setting will also be in effect after a reboot.

Look for any vm.max_map_count line in /etc/sysctl.conf. If you find one, set its value to 524288. If there is no such line present, add the line

add_vm_max_map_count.conf
vm.max_map_count=524288

to the end of /etc/sysctl.conf

Original source: GitHub


Check out similar posts by category: Container, Databases, Docker, Linux