Docker Community Forums

Share and learn in the Docker community.

Update max_map_count for ElasticSearch docker container Mac host

I’m using this container to start elasticsearch in docker. In accordance with the manual I have to update max_map_count to start the container

sudo sysctl -w vm.max_map_count=262144

but… I can update it in my host (container) AFTER I start it while I’m unable to start it. Am I doing something wrong?

ERROR: bootstrap checks failed max virtual memory areas
vm.max_map_count [65530] likely too low, increase to at least [262144]

If I try to do it on my host machine (which is Mac) I get the following error.

sysctl: unknown oid ‘vm.max_map_count’

Docker engine installs the Lunix VM where all containers are running. So the command to increase the limit should be executed for the Linux host, not for the Mac.

How can I access Linux VM via terminal installed by the Docker engine?

Got the same problem today and figured it out. This command is not to be executed in the docker container. It should be executed in the Linux/Ubuntu machine where you run the docker machine. In my case, I ran it in the Linux instance that VirtualBox VM (on Mac) created. e.g. in the Mac terminal:

docker-machine ssh myDocker sudo sysctl -w vm.max_map_count=262144

If you run docker in a Linux/Ubuntu machine (e.g. AWS EC2), simply run it as root in that machine.

Let me know if this works for you.