title: Docker volume and mount
body: <p>I'm not very clear about the behavior of volume and mount</p>
  
  <p><strong>1. no volume, no mount</strong></p>
  
  <pre><code> FROM centos
   RUN mkdir /data
   CMD ["bash"]
  
   docker build -t vm .
   docker run --rm vm mkdir /data/new
  </code></pre>
  
  <p>I'm sure /data/new will not exist in host disk</p>
  
  <p><strong>2. no volume, with mount</strong></p>
  
  <pre><code> FROM centos
   RUN mkdir /data
   CMD ["bash"]
  
   docker build -t vm .
   docker run --rm -v /tmp:/data vm mkdir /data/new
  </code></pre>
  
  <p>/tmp/new exists after container delete without VOLUME, what is the point of VOLUME?</p>
  
  <p><strong>3. with volume, no mount</strong></p>
  
  <pre><code> FROM centos
   RUN mkdir /data
   VOULME /data
   CMD ["bash"]
  
   docker build -t vm .
   docker run --rm  vm mkdir /data/new
  </code></pre>
  
  <p>Will dir <code>new</code> exist in host disk?</p>
  
  <p><strong>4. with volume, with mount</strong></p>
  
  <pre><code> FROM centos
   RUN mkdir /data
   VOULME /data
   CMD ["bash"]
  
   docker build -t vm .
   docker run --rm -v /tmp:/data vm mkdir /data/new
  </code></pre>
  
  <p>Dir <code>new</code> will exist.</p>