java Runtime.getRuntime().availableProcessors() and nproc return different values
<p>I'm running a <code>Java app</code> inside of a <code>docker container</code>, which is restricted to <code>4 CPU</code> and the machine on which the <code>docker container</code> runs, has <code>10 CPU</code>.</p>

<p>When calling <code>nproc</code> inside the <code>docker container</code>, I get as a result <code>4</code>, but when I call <code>Runtime.getRuntime().availableProcessors()</code> I get <code>10</code> as result.</p>

<ul>
<li>why is this happening? How come does <code>Java</code> see all <code>CPU</code>?</li>
<li>is there another way of getting in <code>Java</code> the same result asa <code>nproc</code>, besides using <code>Runtime.getRuntime().exec("nproc")</code>?</li>
</ul>