简体   繁体   中英

How to Give Docker Containers more resources

I'm using docker to create my local dev environment for developing Magento modules. Magento is very slow during most of the operations, and what I've noticed is that the CPU usage is not going higher then 20% for each core (my machine has 8 cores).

Are there any settings I can change to give docker containers more resources in terms of CPU usage?

You can pass custom parameters about resources when use docker run .

Like:

--cpu-shares        CPU shares (relative weight)
--cpu-period        Limit CPU CFS (Completely Fair Scheduler) period
--cpu-quota         Limit CPU CFS (Completely Fair Scheduler) quota
--cpuset-cpus       CPUs in which to allow execution (0-3, 0,1)
--cpuset-mems       MEMs in which to allow execution (0-3, 0,1)

I'm using the version 1.11.1 of Docker, I do not remember, but maybe some of these parameters can only be used in newer versions.

See docker run reference -> https://docs.docker.com/engine/reference/run/

Do you have any other containers running? The documentation states:

By default, all containers get the same proportion of CPU cycles. This proportion can be modified by changing the container's CPU share weighting relative to the weighting of all other running containers.

You are able to modify resource allocation for your containers in your compose file ( link )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM