title: Docker's behavior when mounting volumes
body: <p>I'm currently trying to understand how Docker handles mounting of volumes and ran into the following behavior which seems kind of stange to me:</p>
  
  <p>Assumed that we want to mount the /var/run directory into a container (just as an example), we do the following:</p>
  
  <pre><code>$ docker run -i -t -v /var/run:/test ubuntu:latest /bin/bash
  </code></pre>
  
  <p>So far, everything works fine and all the folders and files residing under /var/run show up inside the container within /test.</p>
  
  <p>Now see what happens if we decide to mount the /var directory:</p>
  
  <pre><code>$ docker run -i -t -v /var:/test ubuntu:latest /bin/bash
  </code></pre>
  
  <p>Still, all the host folders within /var show up inside /test. However, after cd into /test/run, the files and directories from the host are not displayed. In other words, Docker not seems to do a 'recursive' mount of subsequent child directories and their content. Is this ordinary Docker behavior?</p>