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

File not changing inside docker container after updating from 2.1.0.5 to 2.2.0.0

Open adrien-carre opened this issue 6 years ago • 267 comments

  • [X] I have tried with the latest version of my channel (Stable or Edge)
  • [X] I have uploaded Diagnostics
  • Diagnostics ID: 0B5E8EE6-4822-4D32-BE64-EFD8FDFBF13F/20200122095329

Expected behavior

When a file is changed in the windows filesystem, it should be changed inside the container.

Actual behavior

When a file is changed in the windows filesystem, it's not changed, it's the same as when the container started. The file's modification time is not changing as well.

Information

  • Windows Version: 10
  • 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. start a container with shared folder
  2. edit in windows a file in the shared folder
  3. the file is not changed in the container

adrien-carre avatar Jan 22 '20 10:01 adrien-carre

I can confirm this. Same Setup, running as "Linux Containers" if this is somewhat helpfull.

Does anyone already have a solution or workaround?

kohlerdominik avatar Jan 22 '20 11:01 kohlerdominik

My workaround was downgrading to 2.1.0.5

Brainshaker95 avatar Jan 22 '20 11:01 Brainshaker95

How do you downgrade?

SamuelReinfelder avatar Jan 22 '20 11:01 SamuelReinfelder

Me too, I am downgrading to 2.1.0.5

argentinaluiz avatar Jan 22 '20 11:01 argentinaluiz

I'm also downgrading.

@SamuelReinfelder This is the download link for 2.1.0.5 https://download.docker.com/win/stable/40693/Docker%20Desktop%20Installer.exe

Xammie avatar Jan 22 '20 11:01 Xammie

Same issue here - running a few gulp tasks using nginx / urbantrout's Craft CMS image / mysql, it will compile once and then never change the file. Obviously can't develop when your files don't update.

mightyfineyall avatar Jan 22 '20 11:01 mightyfineyall

Same issue. In addition it also seemed to interfere with files loaded in my local IDE (PHPStorm):

  • files were unable to be loaded by the IDE
  • in one case, the contents of a file I was modifying was completely deleted

paslandau avatar Jan 22 '20 13:01 paslandau

Same issue, the only thing that helped was downgrading. Any previous issue is ok

andrei-dascalu avatar Jan 22 '20 14:01 andrei-dascalu

Sorry for the inconvenience, uploading more diagnostics and/or specific reproduction steps would help a lot. Thanks!

mat007 avatar Jan 22 '20 14:01 mat007

Hi @mat007 , for me, I only set in docker-compose.yaml:

volumes:
    - .:/var/www

All changes in any files doesnt persist in container. Thanks!

argentinaluiz avatar Jan 22 '20 14:01 argentinaluiz

Steps to reproduce: Change a shared file on your host. Exec in the docker container check the file in the container that you have changed in your host before.

RESULT: The changes you have made to the file in the host are not "transferred" to the container.

If you restart the docker Environment the changes are there.

frankmohaupt avatar Jan 22 '20 14:01 frankmohaupt

Same Issue; Few differences / Inclusions though;

  • The issue was removed for the better part of an Hour after updating windows to it's latest version.
  • The issue was, for a short time after reappearance, fixable when forcing your cache to clear.
  • If you wait for the better part of 5 minutes the changes to the files will be passed through to the container.
  • There where differences between different types of files in the extend and/or timing of the changes. (E.G.: changes to an HTML file 'seemed' to be quicker in changing the result instantly while any changes to PHP files took longer, but eventually they take the same amount of time before the changes are visible from within the container.)

BenjaminKalle avatar Jan 22 '20 15:01 BenjaminKalle

I also find the converse: Files changed in the container do not show up on the host. The file mount consistency of 2.2.0.0 is not working out.

rfay avatar Jan 22 '20 16:01 rfay

Same issue, but I noticed, that file in container starts being updated after I nano file.html inside container.

kasp3r avatar Jan 23 '20 09:01 kasp3r

My Solution:

Set ":consistent" command behind the volume path

Example: "./www/:/usr/share/nginx/html/www:consistent"

Volume ":cached" is now by default...

blackangelxl avatar Jan 23 '20 11:01 blackangelxl

We're just experiencing similar problems. My colleagues are at version 2.2+ and I just stayed at 2.1.0.5.

My observation:

We're having a php composer project where we're symlinking local git repositories into the vendor dir of composer, e.g.: src/vendor/codename/abc -> src/modules/codename/abc

(changed for human readability and to get the concept of mixing static composer deps with local dev projects using autoloading)

The directories are volume-bound with the whole project dir, so the "symlink" is a local NTFS junction automatically created by composer. We tested volume bindings with no option (default is :cached for the major project files), :cached, :delegated and :consistent - while we're still using :delegated and for local dev DBs, profiler data and logs.

While this still works on my Docker CE 2.1.0.5 on Windows, we just found out manually opening the same PHP file via nano in the container renders different results on later versions of Docker on Windows - though, in theory, it is the same file:

  • src/modules/codename/abc/backend/class/app.php
  • src/vendor/codename/abc/backend/class/app.php

The latter one does not reflect changes performed on the host, while the first one does. This just came to my mind: the new inotify-capability might not reflect NTFS junctions, local symlinks or something inbetween - which might be even a Windows issue?

KevinVonJocoon avatar Jan 23 '20 13:01 KevinVonJocoon

I'm having the same issue, I do change in the host but the changes are not reflected in the docker container.

Information Windows Version: 10 Docker Desktop Version: 2.2.0.0 WSL Version: 2.0

Restarting the docker containers actually updates the content of the files.

ventayol avatar Jan 23 '20 14:01 ventayol

I tried @blackangelxl solution of using :consistent but it doesn't work, changes are not reflected in the docker container.

ventayol avatar Jan 23 '20 15:01 ventayol

Chiming in on this issue, I've noticed my files are not always reflecting changes in the volume as well. I've exec'd into the container and noticed that the date on the file changes to Jan 1, 1970 when the file refuses to update.

Inside the container, if I touch the file, it will then update based on the changes in my volume and this may persist for a short time (shows the correct date at this time) before it stops updating again and the date changes to Jan 1, 1970.

total 0 drwxrwxrwx 1 root root 0 Jan 23 19:22 ./ drwxrwxrwx 1 root root 4096 Jan 23 01:01 ../ -rwxr-xr-x 1 root root 343 Jan 1 1970 data.cfc* -rwxr-xr-x 1 root root 45 Jan 23 19:38 index.cfm*

Aex avatar Jan 23 '20 19:01 Aex

Thanks, @Aex, that's a good observation. It may indicate that this is the same as #5543.

I see that this issue has lots of "me too"s, but I haven't been to reproduce it. Does anyone have a simple, reliable repro with step by step instructions?

stephen-turner avatar Jan 24 '20 10:01 stephen-turner