title: How does docker use CPU cores from its host operating system?
body: <p>My understading, based on the fact that Docker is based on LXC, is that Docker containers share various resources from its host operating system. My concern is with CPU cores. Here is a scenario:</p>
  
  <ul>
  <li>a host linux OS has 8 cores</li>
  <li>I have to deploy a set of docker containers on the host OS above. </li>
  <li>Some of the docker containers that I need to deploy would be better suited to use 2 cores</li>
  </ul>
  
  <p>a) So if I run all of the docker containers on that host, will they consume CPU/cores as needed like if they were being run as normal installed applications on that host OS ? </p>
  
  <p>b) Will the docker container consume its own process and all of the processing that is contained in it will be stuck to that parent process's CPU core ? </p>
  
  <p>c) How can I specify a docker container to use a number of cores ( 4 for example ). I saw there is a -C flag that can point to a core id, but it appears there is no option to specify the container to pick N cores at random. </p>