Docker for windows is not syncing mounted volumes correctly

Docker for windows is not syncing mounted volumes correctly.

Steps to repro:

  1. Create a container with volume sharing. I used -v c:/dev:/mnt/c/dev
  2. Create a file ‘c:\dev\foo.txt’ with contents ‘hello world’
  3. cp -R /mnt/c/dev to somewhere in the container, e.g. ~/dev.
  4. note the contents of ~/dev/foo.txt
  5. In the host c:\dev\foo.txt, change the content to ‘goodbye docker’
  6. in the container, rm -rf ~/dev
  7. re-copy /mnt/c/dev to ~/dev
  8. Note the contents of ~/dev/foo.txt

When I look in my container, the contents are still ‘hello world’. Docker is somehow reading old stale data.

I was able to reproduce this repeatedly when it happened, but after restarting my PC the problem went away. I’m not able to reproduce it anymore.