title: How to sync back files from a Docker container to its host?
body: <p>Maybe I am overcomplicating this. </p>
  
  <p>My goal is to create a Docker-based workflow on Windows for Node.js application development. </p>
  
  <ol>
  <li><p>In development time, I'd be able to run my app locally inside a container and still see the latest version without too much hassle (I don't want to rebuild the image everytime to see the latest).</p></li>
  <li><p>On the other hand, when I deploy to production, I want to have my source files "baked" into the container image with all the dependencies (<code>npm install</code>)</p></li>
  </ol>
  
  <p>So I created two Vagrantfiles - one for the container and one for its host. Here's an extract of the latter:</p>
  
  <pre><code>Vagrant.configure(2) do |config|
    config.vm.provider "docker" do |docker|
      docker.vagrant_vagrantfile = "host/Vagrantfile"  # it references the host Vagrantfile
      docker.build_dir = "."  # we have a Dockerfile in the same dir
      docker.create_args = ['--volume="/usr/src/host:/usr/src/appcontainer:rw"']
    end
  end
  </code></pre>
  
  <p><code>/usr/src/host</code> is a directory which contains all of my source code (without <code>node_modules</code>). During the build of the <code>Dockerfile</code>, Docker copies the <code>package.json</code> to <code>/usr/src/appcontainer</code> and issues an <code>npm install</code> there which is fine for my second requirement (deploy to production)</p>
  
  <p>But my first requirement was to change the source during development, so I mounted <code>/usr/src/appcontainer</code> as a volume pointing to the host directory <code>/usr/src/host</code>. However, this is not working, because <code>/usr/src/host</code> doesn't have a <code>node_modules</code> folder - this folder only exists in the container.</p>
  
  <p>This whole problem seems to be easy - changing a file under Windows, see its changing both under the Linux host VM and in its container and vica versa... But I've got a bit stuck. </p>
  
  <p>What is the best practice to achieve this syncing behaviour?</p>