I'm running ElasticSearch using Docker and I'm starting it using Docker compose with bootstrap.memory_lock=true:
--- version: '3' services: elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:6.0.0 environment: - 'bootstrap.memory_lock=true' ports: - '9200:9200' - '9300:9300'
But I get this error:
[WARN ][o.e.b.JNANatives ] Unable to lock JVM Memory: error=12, reason=Cannot allocate memory [WARN ][o.e.b.JNANatives ] This can result in part of the JVM being swapped out. [WARN ][o.e.b.JNANatives ] Increase RLIMIT_MEMLOCK, soft limit: 65536, hard limit: 65536 [WARN ][o.e.b.JNANatives ] These can be adjusted by modifying /etc/security/limits.conf, for example: # allow user 'elasticsearch' mlockall elasticsearch soft memlock unlimited elasticsearch hard memlock unlimited [WARN ][o.e.b.JNANatives ] If you are logged in interactively, you will have to re-login for the new limits to take effect.
I've added the lines to the file on both my host OS (Ubuntu Server) and the into the container and I've restarted the host OS. How can I fix this issue?