Docker on Mac, and Hyperkit
Docker on Mac has an unusual architecture which makes it difficult to get a clear picture of resource consumption. Docker relies on features unique to the Linux kernel like cgroups to implement containers and as a result, requires Linux to run. Because OSX is not Linux, Docker utilizes a large Linux VM, called hyperkit to run your containers.
As a result of this architecture, running docker stats doesn’t tell you everything you need to know about resource consumption. You’ll get information about the footprint of your Docker containers, but not about hyperkit, the VM needed to run those containers. As we will see, hyperkit can be quite a resource hog, tending to eat more and more memory the longer it runs and the more containers you put on it.
Docker and CPU usage
When Docker consistently uses a lot of CPU cycles, and the fan is running loud, try switching to the latest docker-desktop version (3 is out now).
The Latest comes with:
Downgraded the kernel to 4.19.121 to reduce the CPU usage of hyperkit. Fixes docker/for-mac#5044
Avoid caching bad file sizes and modes when using osxfs. Fixes docker/for-mac#5045.
In my case CPU usage went from 80% to 55%.