5
votes

Using docker (docker-compose) on macOS. When running the Docker containers and attaching Visual Studio Code (VSCode) to the active app container it can make the hyperkit process go crazy :( the macBook fans have to go at full speed to try to keep the temperature down.

When using VSCode on python files I noticed that actions, such as done by pylint, that result in scanning/parsing your file will increase the hyperkit CPU usage to the max and the macBook fans go on full speed :(. Hyperkit CPU usage goes down again when the action of pylint is finished.

When using VSCode to debug my Django Python app the hyperkit CPU usage goes to the max again. When actively debugging the hyperkit goes wild but it does settle down again afterwards.

I'm currently switching "bind mounts" to "volume mounts" I think I see some improvements but haven't done enough testing to say anything conclusive. I've only switched my source code to using "volume mount" instead of "bind mount" and will do the same for my static files and database and see if that results in improvements.

You can check out this stackoverflow post on Docker volumes for some more info on the subject. Here is some post that I found regarding this issue: https://code.visualstudio.com/docs/remote/containers?origin_team=TJ8BCJSSG https://github.com/docker/for-mac/issues/1759

Any other ideas on how to keep the hyperkit process under control❓

[update 27 March] Docker debug mode was set to TRUE I've changed this to FALSE but I have not seen any significant improvements.

[update 27 March] Using "delegated" option for my source code (app) folder and first impressions are positive. I'm seeing significant performance improvements we'll have to see if it lasts ???? FYI Docker docu on delegated: the container’s view is authoritative (permit delays before updates on the container appear in the host)

[update 27 March] I've also reduced the number of CPU cores Docker desktop can use (settings->advanced). Hopefully this prevents the CPU from getting too hot.

1
Do you have to run your application in Docker? On a MacOS host you don't even need to specially install Python; I have a /usr/bin/python3 which should work just fine for ordinary development.David Maze
I know and do. However I want to keep my MacOS clean and have contained environments for each project I'll be working on. Virtual environments work very well with Python but a project has more than just python libraries :). In the past I've used VMWare virtual machines which worked pretty well. Another benefit is that with docker you can have a dev environment that more closely mirrors the production environment and I think we've all had bugs that only appeared on production :).Dennis
Using "delegated" option for my source code (app) folder and first impressions are positive. I'm seeing significant performance improvements we'll have to see if it lasts 😀 FYI Docker docu on delegated: the container’s view is authoritative (permit delays before updates on the container appear in the host)Dennis
I've also reduced the number of CPU cores Docker desktop can use (settings->advanced). Hopefully this prevents the CPU from getting too hot. Recent changes have improved the performance but I have a nagging suspicion that it can be better.Dennis

1 Answers

1
votes

Hoping it's not too late I "solved" this issue by using http://docker-sync.io to create volumes that I can mount without raising my CPU usage at all. I am currently running 8 containers (6 python and 2 node) with file watchers on and my CPU is at 25% usage.