In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces how docker allocates resources to containers, the content is very detailed, interested friends can use for reference, I hope it can be helpful to you.
How does docker allocate resources to containers? By default, there is no limit to the resource allocation of the docker container, and the host can use as many resources as it has. Docker can limit the use of memory, CPU, and IO resources.
Docker can set these options when docker run or docker build. The line selection and rules are set as follows:
Memory
-m or-memory:
-memory-swap *: this command depends on-m
CPU
CPU is allocated pro rata.
-cpus= uses value core cpu. For example, if cpu is dual-core, you can set-cpus= "1.5", which means that a 1.5-core cpu is assigned to the container.
-cup-shares: when there are multiple docker, all docker allocate cpu resources proportionally. If other docker is free and only one docker is busy, he can use up all cpu.
-cpuset-cpus: specify which cpu docker is running on, for example, the 4-core cpu is numbered [0-3]
By default, all containers can use host CPU resources equally and without restrictions. Docker can set the weight of the container's use of CPU with-c or-cpu-shares. If not specified, the default value is 1024.
Test memory
Docker run-- name S1-it-- rm-m 256m lorel/docker-stress-ng stress--vm 2
Use the above command to start a container that uses up to 256m of memory. Although you enter the container to check that the total memory is the same as the physical memory, you can see that you can only use a maximum of 256m of memory by using docker stats S1.
So much for sharing how docker allocates resources to containers. I hope the above can help you and learn more. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.