125

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

7
  • 2
    I see this on my local system FWIW, but I can right-click on the column header and also enable “Real Memory” and “Compressed Memory” columns. I suspect this column is over-counting virtual memory the process has made space for, but not actually requested real memory. Commented Oct 9, 2019 at 16:53
  • 6
    In github.com/docker/for-mac/issues/3232 there is a link to the following document: Understanding memory usage in Docker Desktop on Mac which also mentions checking the "Real Memory". There are multiple experimentations with some nice details in there. 👍 Commented Jan 24, 2020 at 15:30
  • 1
    Docker also use %50 cpu on my macbook pro... Commented Apr 11, 2020 at 13:44
  • 2
    my cpu usage is 160% .My system mac os catalina 10.15.5, docker version 2.3.0.3 stable. my computer fan went crazy Commented Jun 7, 2020 at 11:37
  • 1
    my mac also does exactly what @melihsahin described. Commented Jul 9, 2020 at 9:13

3 Answers 3

101

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

Sign up to request clarification or add additional context in comments.

11 Comments

In my case hyperkit takes up 14.26GB of memory and 114MB of real memory. kernel_task takes up 11.44GB of real memory. When I stop hyperkit, kernel_task drops to 7.8GB
Ok. What's the solution to the issue ? If starting docker hangs system, apps freeze. Stopping docker works fine. Yes there are memory differences in the activity monitor interface. All I see is com.docker.hyperkit value is huge
So the answer is "don't worry about it"?
My fan is still spinning like crazy and my laptop is much slower even.
If the real memory consumed by hyperkit is significantly lower than the allocated memory, you can configure Docker Desktop to use an amount much closer to the real memory used.
|
39

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

3 Comments

This is what i was looking for really. My computer has now landed back on earth thank you!
I don't know why people say Docker is better than VirtualBox when it comes to resources... these are the same kinds of settings in VirtualBox... limiting them has the same effect.
This is a limit of Mac, having to spin up a virtual machine instead of running docker natively, with minimal memory usage.
2

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

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.