title: docker persistent storage via volume
body: <p>All that read are saying that we can create docker persistent storage via the <code>VOLUME</code> control, e.g., <a href="https://dev.to/jibinliu/how-to-persist-data-in-docker-container-2m72" rel="nofollow noreferrer">here</a> and <a href="https://thenewstack.io/methods-dealing-container-storage/" rel="nofollow noreferrer">here</a>.</p>
  
  <p>However, I have the following in my <code>Dockerfile</code>:</p>
  
  <pre><code>VOLUME      ["/home", "/root"]
  </code></pre>
  
  <p>but nothing was kept in there (I tried <code>touch abc</code>, and when I exit and get back in again the file is not there). </p>
  
  <p>I see that the <a href="https://docs.docker.com/engine/examples/apt-cacher-ng/" rel="nofollow noreferrer">official usage</a> has no other special controls or treatments, yet it can provide persistent storage, even the <code>apt-cacher-ng</code> service container is stopped. </p>
  
  <p>How is that possible? I've checked out the following but still don't have a clue:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/46562966/docker-volume-persistent">Docker volume persistent</a></li>
  <li><a href="https://stackoverflow.com/questions/53766998/persistent-docker-volume">Persistent Docker volume</a></li>
  <li><a href="https://stackoverflow.com/questions/52476138/">Docker volume vs. persistent volume on official Docker beginner tutorial</a></li>
  </ul>
  
  <p>In conclusion, as explained <a href="https://thenewstack.io/methods-dealing-container-storage/" rel="nofollow noreferrer">here</a>:</p>
  
  <blockquote>
    <p>The first mechanism will create an implicit storage sandbox for the container that requested host-based persistence. ... The key thing to understand is that the data stored in the sandbox is not available to other containers, except the one that requested it.</p>
  </blockquote>
  
  <p>How can I make persistent storage works? Why my changes are wiped each time, while the <code>apt-cacher-ng</code> service container can maintain its persistent storage even it is stopped and restarted? 
  What is the <em>"other special controls or treatments"</em> that I failed to see here?</p>
  
  <p>Explain with plain simple <code>Dockerfile</code> (not <code>docker-compose.yml</code> ) please. </p>