Changes in files on mounted filesystem are not visible in container
- [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
- Change file on the host filesystem which is mounted to Docker container.
- Check the modification time. They often differ - the file in the container is not updated.
Workarounds to get files updated again:
- wait until Docker does it (sometimes it happen sooner or later) or
- restart Docker
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.
- volume mount /etc/nginx/
- edit nginx.conf on the OS
- no change in the container going on 10 minutes
- go to container and "cd /etc/nginx", then issue "touch unrelatedfile.txt"
- 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.
Likely a duplicate of #5530
Closing as dupe of #5530.
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