Increase hyperkit memory for Docker on Mac

I am running the Docker CE version 17.09 on a Mac. The overall experience with the default configuration feels so much like running docker on linux, that you’d almost forget that the docker containers are running in their own VM, with its own disks, cpu and memory settings. Long story short, here is how to watch memory usage, and increase it if necessary.

Enter the HyperKit VM to watch memory usage of the docker host

Enter this command and press ‘enter’ to enter the HyperKit VM

screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
<press enter>
free
top
etc..

Increase HyperKit memory

Click the docker symbol in the menuScreen Shot 2017-12-07 at 05.04.01 bar, and select ‘Preferences’ from the docker menu. Then select the ‘Advanced’ tab. Here you will be able to change the amount of memory.

Note that this is maximum memory. The hyperkit vm will not consume that much memory if you do not use it.

Finding the right memory setting for HyperKit

HyperKit’s memory itself can be monitored by the Mac’s Activity Monitor. If you see that it runs to its maximum, check in the hyperkit itself the memory usage is linux filesystem buffers, or real application usage. In the former case, restart docker. In the latter case, you might need to give HyperKit more or less memory, depending on your actual usage.

Background

I was hit by a python command reporting a database crash, after switching from docker-compose to docker swarm mode. The crash looked like a process killed by the OOM killer, but since the setup worked fine in docker-compose mode, I did not immediately suspect memory problems. I watched memory usage on the host with the Mac’s Activity Monitor (wrong, should have accessed the HyperKit VM!) and that did not show excess memory usage. The default settings of HyperKit of 2GB prevented my application from using more memory, and crash instead.

 

Advertenties

Geef een reactie

Vul je gegevens in of klik op een icoon om in te loggen.

WordPress.com logo

Je reageert onder je WordPress.com account. Log uit /  Bijwerken )

Google+ photo

Je reageert onder je Google+ account. Log uit /  Bijwerken )

Twitter-afbeelding

Je reageert onder je Twitter account. Log uit /  Bijwerken )

Facebook foto

Je reageert onder je Facebook account. Log uit /  Bijwerken )

Verbinden met %s