Edgar2022-04-15 16:45:25
Edgar, 2022-04-15 16:45:25

Docker Desktop consumes a lot of resources, loads the processor and RAM. What to do?

There is a laptop with a processor 2 cores at 2.8 in 4 threads, 16 gigabytes of RAM. There was a need to run a NodeJS backend + database in order to work on the React frontend.
I came across the fact that during the launch of containers there was a rather high load on the processor, which of course affected the heating and rotation speed of the cooler, and after its launch, the load remained up to 20%, although there were no special calculations, which caused my bewilderment.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Edgar, 2022-04-15

First I found .wslconfig, reduced the amount of resources there, it seemed to get a little better, and then I accidentally turned off WSL2 in the Docker settings and noticed that the load decreased.
Then I experimented and made a list. Because for weak devices it can be critical.
- Use Hyper-V instead of WSL2. This happens by itself if you disable the use of WSL2 in the settings.
- Disable sending anonymous statistics.
- Disable automatic checking and downloading updates.
- On Hyper-V, Docker practically does not load the system if it is run once, if it is closed and reopened, it starts to load. After starting the containers, you can kill the Docker process in the task manager that loads the CPU. Without that process, everything continued to work normally and nothing closed. The reasons for this behavior are not clear.
- Set the resources allocated for Hyper-V to a minimum, or increase if necessary for the contents of the container. But applications on NodeJS have enough and a minimum of resources. For WLS2, resources are configured in the Windows user folder in the .wslconfig file, WLS2 loads the system more and feels slower, despite the fact that the docker settings say that this is a more productive solution.
- Thanks to these actions, Docker starts to work faster, consumes almost no CPU and RAM, which is good. Tested with containers where there was a database and backend on NodeJS.
Everything that is described here is personal experience, Docker Desktop was version 4.7.0, not the fact that your experience will coincide with mine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question