Elasticsearch Memlock with Docker

Hi, We are using elasticsearch in a Docker container with one node . We want to use memlock parameter as true. But when we set
bootstrap.memory_lock: true in elasticsearch.yml file we received ;

ERROR: [1] bootstrap checks failed
[1]: memory locking requested for elasticsearch process but memory is not locked


Here elasticsearch.yml file ;

http.host: 0.0.0.0

transport.host: 0.0.0.0
#discovery.zen.minimum_master_nodes: 1

bootstrap.memory_lock: true

#index.refresh_interval: 30s
#index.translog.flush_threshold_ops: 50000

Here docker-entrypoint.sh;

#!/bin/bash

set -e
if [ "${1:0:1}" = '-' ]; then
set -- elasticsearch "$@"
fi

if [ "$1" = 'elasticsearch' -a "$(id -u)" = '0' ]; then
# Change the ownership of user-mutable directories to elasticsearch
for path in
/usr/share/elasticsearch/data
/usr/share/elasticsearch/logs
; do
chown -R elasticsearch:elasticsearch "$path"
done

set -- gosu elasticsearch "$@"
#exec gosu elasticsearch "$BASH_SOURCE" "$@"

fi
exec "$@"

Could you please help us?

There is too many configuration suggestion on the web. We try some of them but couldn't find a exact solution.

The last we try to set this parameters with entrypoint.sh in container;

echo "LimitMEMLOCK=infinity" >> /usr/lib/systemd/system/elasticsearch.service
echo "MAX_LOCKED_MEMORY=unlimited" >> /etc/init.d/elasticsearch
echo "elasticsearch soft memlock unlimited" >> /etc/security/limits.conf
echo "elasticsearch hard memlock unlimited" >> /etc/security/limits.conf

But the error continues.

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