title: Is docker shm-size subject to deploy memory limits
body: <p>I'm using docker and docker-compose to conduct a few performance tests on a Postgres instance. I've read somewhere that the <code>/dev/shm</code> mounted inside the container is a separate space from the host's one. I can't seem to find any explanation on how does that relate to the memory limits set on the container.</p>
  <p>Minimal example follows:</p>
  <pre><code>version: &quot;3.9&quot;
  services:
    postgres:
      image: postgres:14
      shm_size: '2gb'
      deploy:
        resources:
          limits:
            memory: '24gb'
  </code></pre>
  <p>Will the container use:</p>
  <ul>
  <li>up to 24gb (2 for shm and remaining 22 for applications in the container)</li>
  <li>up to 26gb (2 for shm from a separate pool, <strong>deducted from the host</strong> and 24 for the app)</li>
  <li>? some other scenario</li>
  </ul>