title: How many CPUs does my docker container have?
body: <p>I'm writing a library that operates in parallel.  This library is often used within docker containers.  I would like to start as many threads as my docker container has allocated cores.  </p>
  
  <p>Does docker set the CPUs limit somewhere as an environment variable?</p>
  
  <p>For example if my user sets two CPUs when creating the container:</p>
  
  <pre><code>docker run --cpuset-cpus="2" myapp:latest
  </code></pre>
  
  <p>(see <a href="https://stackoverflow.com/questions/37871540/how-many-cpus-does-a-docker-container-use">this question</a>)</p>
  
  <p>How do I get back the number <code>2</code> from within the container by inspecting the container's state?</p>