Docker Community Forums

Share and learn in the Docker community.

Setting vm.max_map_count on MobyLinuxVM


(Arno den Uijl) #1

Expected behavior

Running docker run -e ES_JAVA_OPTS="-Xms1g -Xmx1g" -it --rm elasticsearch:5 -E es.bootstrap.seccomp=false should start elasticsearch.

Actual behavior

The docker image starts but elasticsearch fails with
Exception in thread "main" java.lang.RuntimeException: bootstrap checks failed
max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]

Information

On the docker forum (https://github.com/docker-library/elasticsearch/issues/98#issuecomment-218071315) the solution presented is to run sudo sysctl -w vm.max_map_count=262144 on the docker host. Is there any way to do this on the mobylinuxvm host?!

Steps to reproduce the behavior

  1. Run docker run -e ES_JAVA_OPTS="-Xms1g -Xmx1g" -it --rm elasticsearch:5 -E es.bootstrap.seccomp=false

(David Maze) #2

docker run --privileged is probably the easiest way (remember, all containers share the same kernel and so the same sysctl settings, but I think you need to be --privileged to change them).

There’s also a magic screen command that can get a shell on the VM console, but this is bulkier and harder to script. It’s been mentioned on the forum several times.


(Arno den Uijl) #3

In a recent update of docker for windows the Docker Daemon settings tab was added where you can set settings in the daemon configuration file (https://docs.docker.com/engine/reference/commandline/dockerd/#/daemon-configuration-file)

If i’m not mistaken you can set the vm.max_map_count via these settings. I think I even did it a month ago but I can’t remember how I did it or where I found how to do it.

Anyone an idea how to do this?