for-win icon indicating copy to clipboard operation
for-win copied to clipboard

Changes in files on mounted filesystem are not visible in container

Open snekcz opened this issue 6 years ago • 5 comments

  • [x] I have tried with the latest version of my channel (Stable or Edge)
  • [x] I have uploaded Diagnostics
  • Diagnostics ID: 23379FB9-A5CD-4FE6-9206-CBF82284EFB0/20200201150955

Expected behavior

Each change in files on monted filesystem from host, should be instantly visible in the container.

Actual behavior

Changes in files on mounted filesystem are not visible in the container. It seems some caching is in place, not properly updated. Example: ls -l from the container outputs:

root@6a9f78eb9106:/var/www/html# ls -l kurice.php
-rwxr-xr-x 1 root root 9931 Feb  1 14:57 kurice.php

ls -l on the host (Windows, command run in WSL terminal):

tomas@Dexik:/c/DATA/Microsnail/DEV/statekdvorak/www$ ls -l kurice.php
-rwxrwxrwx 1 tomas tomas 9938 Feb  1 16:29 kurice.php
tomas@Dexik:/c/DATA/Microsnail/DEV/statekdvorak/www$ date
Sat Feb  1 16:30:04 CET 2020

Note: one hour difference is ok - container has UTC time set, my host is on CET time.

Information

  • Is it reproducible? Yes - it does not happen always, but very often.

  • Is the problem new? Yes

  • Did the problem appear with an update? Yes

  • Windows Version: 1903

  • Docker Desktop Version: 2.2.0.0

  • Are you running inside a virtualized Windows e.g. on a cloud server or on a mac VM: No

Steps to reproduce the behavior

  1. Change file on the host filesystem which is mounted to Docker container.
  2. Check the modification time. They often differ - the file in the container is not updated.

snekcz avatar Feb 01 '20 15:02 snekcz

Workarounds to get files updated again:

  1. wait until Docker does it (sometimes it happen sooner or later) or
  2. restart Docker

snekcz avatar Feb 01 '20 15:02 snekcz

I've seen this. My 2c,

  • seems worse on files shared rather than directories (e.g. volume mount /etc/nginx/nginx.conf vs. /etc/nginx/ ) .
  • better if there are other edits in the same directory, so I can force the container to see the change with the following sequence.
  1. volume mount /etc/nginx/
  2. edit nginx.conf on the OS
  3. no change in the container going on 10 minutes
  4. go to container and "cd /etc/nginx", then issue "touch unrelatedfile.txt"
  5. unrelatedfile.txt instantly reflects on host OS, and changes to nginx.conf relfect in the container

Like the author pointed out it seems to be related to caching. Changes to the caching mechanisms (e.g. consistent option) don't seem to change the underlying issues.

ryangroth5 avatar Feb 02 '20 16:02 ryangroth5

Likely a duplicate of #5530

ryangroth5 avatar Feb 02 '20 17:02 ryangroth5

Closing as dupe of #5530.

stephen-turner avatar Feb 03 '20 09:02 stephen-turner

Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle locked

docker-robott avatar Jul 13 '20 03:07 docker-robott