In my host machine, I have 4 cpu cores (as per Python multiprocessing library):
python Python 2.7.8 (v2.7.8:ee879c0ffa11, Jun 29 2014, 21:07:35) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import multiprocessing >>> multiprocessing.cpu_count() 4 However when I run Python in a Docker container it says something different:
docker run -it python Python 3.6.5 (default, Mar 31 2018, 01:15:58) [GCC 4.9.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import multiprocessing >>> multiprocessing.cpu_count() 2 Also, when I try to add more CPUs to the container I get an even stranger response:
docker run -it --cpuset-cpus "4" python docker: Error response from daemon: Requested CPUs are not available - requested 4, available: 0-1. why is that? And how do I make my container see all my CPU cores?
