Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 908
Alexey Strakh Avatar asked Dec 16 '16 21:12

Alexey Strakh


4 Answers

On Docker Toolbox

If you are in docker toolbox try the docker client from terminal and then make the configs:

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

On Docker For Mac:

The vm_max_map_count setting must be set within the xhyve virtual machine:

$ screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty

If it asks you for a username and passwordLog in with root and no password.

If it just has a blank screen, press RETURN.

Then configure the sysctl setting as you would for Linux:

sysctl -w vm.max_map_count=262144

Exit by Control-A Control-\.

Se the docs here.

Persistence

In some cases, this change does not persist across restarts of the VM. So, while screen'd into, edit the file /etc/sysctl.d/00-alpine.conf and add the parameter vm.max_map_count=262144 to the end of file.

like image 133
Octavio Soto Avatar answered Nov 16 '22 01:11

Octavio Soto


On Latest Docker For Mac (Version 18.06.0-ce-mac70):

$ screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty

On the blank screen, press RETURN.

Then configure the sysctl setting as you would for Linux:

sysctl -w vm.max_map_count=262144

Exit by Control-A Control-\

like image 33
Charith De Silva Avatar answered Nov 16 '22 01:11

Charith De Silva


For those using Docker Desktop on windows 10 you have to execute:

wsl -d docker-desktop in the command line before sysctl -w vm.max_map_count=262144

like image 4
Hayi Avatar answered Nov 16 '22 01:11

Hayi


For those who use docker desktop on mac, you can easily increase the memory by the following steps:

  1. click on docker desktop -> preferences...
  2. navigate to 'Resources'
  3. change the memory to whatever you need
  4. click on 'Apply & Restard'
like image 1
Bye Avatar answered Nov 16 '22 01:11

Bye