Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker for mac memory usage in com.docker.hyperkit

I'm running docker desktop community 2.1.0.3 on MacOS Mojave. I've got 8GB of memory allocated to Docker, which already seems like a lot (that's half my RAM). Somehow even after exiting and then starting Docker for Mac again, which means no containers are running, docker is already exceeding the memory allocation by 1GB.

What is expected memory usage for docker with no containers running? Is there a memory leak in docker for mac or docker's hyperkit?

enter image description here

docker for mac memory leak

like image 326
williamcodes Avatar asked Oct 09 '19 16:10

williamcodes


People also ask

How much RAM should I allocate to Docker?

Limit a container's access to memory The maximum amount of memory the container can use. If you set this option, the minimum allowed value is 6m (6 megabytes). That is, you must set the value to at least 6 megabytes. The amount of memory this container is allowed to swap to disk.

How do I reduce my Docker RAM usage?

To limit the maximum amount of memory usage for a container, add the --memory option to the docker run command. Alternatively, you can use the shortcut -m . Within the command, specify how much memory you want to dedicate to that specific container.

Is Docker for Mac good?

Here's a quick summary with the best benefits of using Docker for Mac: Pretty smooth and simple installation process. No more VirtualBox! No problems with virtual machines, filesystems or other bugs you might have encountered with the Docker Toolbox.

Does Docker consume memory?

Docker does not apply memory limitations to containers by default. The Host's Kernel Scheduler determines the capacity provided to the Docker memory. This means that in theory, it is possible for a Docker container to consume the entire host's memory.


3 Answers

As @GabLeRoux has shared in a comment, the "Real Memory" usage is much lower than what you see in the "Memory" column in Activity Monitor.

This document thoroughly explains memory usage on Mac OS with Docker Desktop and information is excerpted from there.

To see the "Real Memory" used by Docker, right-click the column names in Activity Monitor and Select "Real Memory". The value in this column is what's currently physically allocated to com.docker.hyperkit.

enter image description here

like image 164
jbielick Avatar answered Oct 10 '22 12:10

jbielick


Alternate answer: I reduced the number of CPUs and Memory Docker is allowed to use within the Docker Resources preferences. My computer is running faster and quieter now.

I just now put this in place, so time will tell if this solution works for me. Before it was making my computer max out on memory. Now it's significantly reduced.

Thank you for the note on real memory. I added that to my Activity Monitor.

UPDATE: It's been a few days now and my computer runs well below the max of memory and my fan runs at a minimum if at all.

Docker resources

Mac memory activity

Mac memory usage

like image 24
Adam Avatar answered Oct 10 '22 13:10

Adam


I think you shouldn't be using swap while ram is not full, for ssd health and speed

like image 2
Adrian Avatar answered Oct 10 '22 12:10

Adrian