I am using docker SDK for python 3 and running a container using
containers.run
We would like to set the number of CPU cores the container is getting and looked here
There we saw there is a way to set the number of cores only under windows
How can you do it in Ubuntu via that sdk in Python?
If not at all, How can i control the container getting 1 core, 2 cores etc.?
you may use cpuset_cpus
cpuset_cpus (str) – CPUs in which to allow execution (0-3, 0,1).
so it looks like:
client.containers.run('alpine', cpuset_cpus="1")
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.