Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check the number of cores used by docker container?

I have been working with Docker for a while now, I have installed docker and launched a container using

docker run -it --cpuset-cpus=0 ubuntu

When I log into the docker console and run

grep processor /proc/cpuinfo | wc -l

It shows 3 which are the number of cores I have on my host machine.

Any idea on how to restrict the resources to the container and how to verify the restrictions??

like image 935
user3398900 Avatar asked Nov 29 '17 05:11

user3398900


1 Answers

The issue has been already raised in #20770. The file /sys/fs/cgroup/cpuset/cpuset.cpus reflects the correct output.

The cpuset-cpus is taking effect however is not being reflected in /proc/cpuinfo

like image 157
yamenk Avatar answered Oct 12 '22 13:10

yamenk