title: How to mount volume from container to host in Docker?
body: <p>I have a question regarding the whole data volume process in Docker. Basically here are two Dockerfiles and their respective run commands:</p>
  
  <p><strong>Dockerfile 1 -</strong></p>
  
  <pre><code># Transmission over Debian
  #
  # Version 2.92
  
  FROM debian:testing
  
  RUN apt-get update \
      &amp;&amp; apt-get -y install nano \
      &amp;&amp; apt-get -y install transmission-daemon transmission-common transmission-cli \
      &amp;&amp; mkdir -p /transmission/config /transmission/watch /transmission/download
  
  ENTRYPOINT ["transmission-daemon", "--foreground"]
  CMD ["--config-dir", "/transmission/config", "--watch-dir", "/transmission/watch", "--download-dir", "/transmission/download", "--allowed", "*", "--no-blocklist", "--no-auth", "--no-dht", "--no-lpd", "--encryption-preferred"]
  </code></pre>
  
  <p><strong>Command 1 -</strong></p>
  
  <pre><code>docker run --name transmission -d -p 9091:9091 -v C:\path\to\config:/transmission/config -v C:\path\to\watch:/transmission/watch -v C:\path\to\download:/transmission/download transmission  
  </code></pre>
  
  <p><strong>Dockerfile 2 -</strong></p>
  
  <pre><code># Nginx over Debian
  #
  # Version 1.10.3
  
  FROM debian:testing
  
  RUN apt-get update \
      &amp;&amp; apt-get -y install nano \
      &amp;&amp; apt-get -y install nginx
  
  EXPOSE 80 443
  
  CMD ["nginx", "-g", "daemon off;"]
  </code></pre>
  
  <p><strong>Command 2 -</strong></p>
  
  <pre><code>docker run --name nginx -d -p 80:80 -v C:\path\to\config:/etc/nginx -v C:\path\to\html:/var/www/html nginx
  </code></pre>
  
  <p>So, the weird thing is that the first dockerfile and command works as intended. Where the docker daemon mounts a directory from the container to the host. So, I am able to edit the configuration files as I please and they will be persisted to the container on a restart.</p>
  
  <p>However, as for the second dockerfile and command it doesn't seem to be working. I know if you go to the Docker Volume documentation it says that volume mounts are only intended to go one-way, from host-to-container, but how come the Transmission container works as intended, while the Nginx container doesn't?</p>
  
  <p>P:S - I'm running <em>Microsoft Windows 10 Pro Build 14393</em> as my host and <em>Version 17.03.0-ce-win1 (10300) Channel: beta</em> as my Docker version.</p>
  
  <p>Edit - Just to clarify. I'm trying to get the files from inside the Nginx container to the host. The first container (Transmission) works in that regard, by using a data volume. However, for the second container (Nginx), it doesn't want to copy the files in the mounted directory from inside the container to the host. Everything else is working though, it does successfully start.</p>