Answer the question
In order to leave comments, you need to log in
How to limit memory and cpu in docker?
There is a project in PHP, there is a docker-compose config for it. For this project, Docker is used only to run the same LAMP environment locally on the developers' computers. Those. using the command:
docker-compose -f ../../docker-compose.yml up -d
But the problem is that one of the containers, the one in which Apache and PHP run, gradually eats up all the computer's RAM to the limit. At the same time, no background PHP scripts are running. Why this happens is unknown, it looks like a memory leak, either in PHP, or in Apache ...
Is it possible to limit the use of RAM and CPU by Docker, globally for all containers, or for individual ones?
Is it possible to set this restriction through any Docker configs itself, or through the docker-compose config?
Options:
CGroups - but I haven't figured out exactly how yet.
Create a virtual machine and run Docker containers on it - higher than the resources of the Docker virtual machine will not climb.
In the docker-compose config in the deploy section, but this option is probably not suitable, because. used by Docker only locally to set up the LEMP environment.
Answer the question
In order to leave comments, you need to log in
used by Docker only locally to set up the LEMP environment
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question