Update max_map_count for ElasticSearch docker container Mac host

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-\


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.


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