title: Docker Volumes - Automatically adding files
body: <p>I am trying to create a docker container that has an external volume which should contain several folders, so my simplified version of the Dockerfile looks like this:</p>
  
  <pre><code>FROM ubuntu:12.04
  
  # Create a volume for externally stored data that will persist across containers.
  VOLUME ["/uploads"]
  
  # Add the subfolders we need if they dont already exist
  # however this never works.
  RUN mkdir /uploads/folder1
  RUN mkdir /uploads/folder2
  </code></pre>
  
  <p>Whenever I launch the container with </p>
  
  <pre><code>sudo docker run -i -t -v /uploads:/uploads [IMAGE ID] /bin/bash
  </code></pre>
  
  <p>The /uploads folder does not contain folder1 or folder2. However, if I replace the the VOLUME uploads line with a <code>RUN mkdir /uploads</code> it does work with this command</p>
  
  <pre><code>sudo docker run -i -t [IMAGE ID] /bin/bash
  </code></pre>
  
  <p>but not with this command (folders are missing again):</p>
  
  <pre><code>sudo docker run -i -t -v /uploads:/uploads [IMAGE ID] /bin/bash
  </code></pre>
  
  <p>How can I set up the dockerfile so that files/folders will automatically get added to the hosts mounted directory upon running the container?</p>