Docker Community Forums

Share and learn in the Docker community.

How do I make persistent settings (sysctl.conf and others) changes to the virtual machine?

docker
beta

(Sebastian ) #1

for one of my images I need some sysctl.conf changes made on the machine, currently I am using this:

screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty root to hop in the machine and edit the file /etc/sysctl.conf

After restarting the docker app the settings are lost, is there a way to make those changes permanent?


(Michael Friis) #2

Out of curiosity, what setting in sysctl.conf are you looking to change?


(Sebastian ) #3

Elasticsearch 5 requires specific settings for example (vm.max_map_count=262144)


(Chronotale) #4

I’m seeing the same issue when trying to run a container with elasticsearch 5 - wanted to know how you got into the docker vm to change the /etc/sysctl.conf (its asking for a login/password). Ideally it would be possible to change this setting somewhere though.

Edit: For someone else’s reference, I got past this by changing a setting in elasticsearch’s config: bootstrap.ignore_system_bootstrap_checks=true


(Sebastian ) #5

I used screen

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

(Vladimir Epifanov) #6

vim ~/Library/Containers/com.docker.docker/Data/database/com.docker.driver.amd64-linux/etc/sysctl.conf — you can use it like this. And don’t forget to git commit it


(Jsong0104) #7

This is what I did:
docker-machine ssh [machine_name]
sudo vi /var/lib/boot2docker/bootlocal.sh
Add the following command to bootlocal.sh: sysctl -w vm.max_map_count=262144
sudo chmod +x /var/lib/boot2docker/bootlocal.sh
exit