Hi,
With the latest version of Docker for Windows and a mobylinux.
I have a php git repository that 2 of my containers use. I modify a random file on the host : README.md
Then I do these git command one after the others :
git stash # ok
git stash pop # ok
git stash # ok
git stash pop # ok
git stash : => Takes 1 minute, then :
error: unable to create file README.md: Permission denied
fatal: Could not reset index file to revision 'HEAD'.
I also noticed that from inside the container :
root@317635dc4f03:watch -n 1 head README.md
Every 1.0s: head README.md
head: cannot open 'README.md' for reading: Stale file handle
Then, still from the container
head: cannot open 'README.md' for reading: No such file or directory
On the Window host the file is visible but I can’t open it neither delete it (permission denied)
To fix it, I need to stop docker, stop the Hyper-V MobyLinuxVM,and wait to be able to restore the README.md file with a git reset --hard
Is there any way to avoid this kind of file sharing problem ?
Cheers.
Docker 17.06.0-ce | Windows 10 pro : 15063.540 | Hyper-V : 10.0.15063.0 | Moby, trusty,
HI,
My proposal would be. … **Just share the stuff that is needed, inside the containers, and let the .git directory reside somewhere else".
-------- reasoning: -------------
IMO that assumption to “modify a random file” where “a” == 1, is wrong. You are probably changing a dozen or more files. The git CLI works with the .git``directory. So your stash commands probably change a dozen files in the .git directory, that are probably all synced to the container, if they are shared. …
The “Docker 4 Windows” file sharing functionality is based on the CIFS protocol which has a lot of moving parts. See the “Figure B.17 CIFS Architecture” at the link.
The git cli commands think, they are using direct file access. They don’t care, if there is a “network” in between. So it seems somewhere on the way of syncing, something goes wrong. …