Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volume file changes are not detected in container on Windows 10 host #30105

Closed
micdahl opened this issue Jan 12, 2017 · 11 comments
Closed

Volume file changes are not detected in container on Windows 10 host #30105

micdahl opened this issue Jan 12, 2017 · 11 comments

Comments

@micdahl
Copy link

micdahl commented Jan 12, 2017

Description
Using docker for developing an Angular CLI app, running via ng serve inside the container does not detect file changes made on the host in a volume. Therfore I have to restart docker run everytime I made changes to files. Timestamp and content of the files though are updated in the container. So alternative I can use touch inside the container to rebuild but this is not really a satisfying development flow as I have to do this for every changed file.

Steps to reproduce the issue:

  1. Run docker build for the Dockerfile given below
  2. Start container with a volume pointing to a directory on the host
  3. Run ng init inside of the container
  4. Run npm start inside of the container
  5. Edit and save src files on the host

Describe the results you received:
Edited file and timestamp change inside of the container, but ng build process is not restarted,

Describe the results you expected:
Edited file and timestamp change inside of the container and ng build process gets restarted,

Additional information you deem important (e.g. issue happens only occasionally):
Thought first, this was a docker-compose issue but running the container without compose had the same results.

Output of docker version:

    Client:
    Version: 1.12.6
    API version: 1.24
    Go version: go1.6.4
    Git commit: 78d1802
    Built: Wed Jan 11 00:23:16 2017
    OS/Arch: windows/amd64

    Server:
    Version: 1.12.6
    API version: 1.24
    Go version: go1.6.4
    Git commit: 78d1802
    Built: Wed Jan 11 00:23:16 2017
    OS/Arch: linux/amd64

Output of docker info:

Containers: 68
Running: 0
Paused: 0
Stopped: 68
Images: 176
Server Version: 1.12.6
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 265
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 4.4.41-moby
Operating System: Alpine Linux v3.4
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.919 GiB
Name: moby
ID: YYNX:753B:ZI7R:HAY4:EVAG:WBK2:RD6P:YS7Y:Z67V:3SY3:JFUL:PLDQ
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 13
Goroutines: 23
System Time: 2017-01-12T15:08:14.0497198Z
EventsListeners: 0
Registry: https://index.docker.io/v1/
WARNING: No kernel memory limit support
Insecure Registries:
127.0.0.0/8

Dockerfile

    FROM node:latest

    RUN apt-get update && apt-get install -y xvfb chromium
    RUN npm install -g angular-cli

    ENV APP_HOME /usr/src/app

    RUN mkdir -p $APP_HOME

    WORKDIR $APP_HOME

    EXPOSE 4200

    CMD ["npm", "start"]
@friism
Copy link
Contributor

friism commented Jan 12, 2017

This is a known limitation of Docker for Windows: https://docs.docker.com/docker-for-windows/troubleshoot/#/inotify-on-shared-drives-does-not-work

As a workaround, you can probably use polling: https://www.npmjs.com/package/onchange#poll---p----poll-

@thaJeztah
Copy link
Member

Let me close this issue; a more in-depth discussion about this can be found in the docker for windows issue tracker (I noticed you were already redirected from the docker compose issue tracker, apologies for that 😄); see here for that discussion docker/for-win#56

Thanks for reporting though, and feel free to comment here after I closed 👍

@micdahl
Copy link
Author

micdahl commented Jan 26, 2017

@friism Thank you for the advice with polling.
For those who are getting into the same troubles: To achieve this with angular-cli,
"poll": 1000 has to be inserted into the defaults-object in angular-cli.json. Unfortunately, this is not well documented.

see angular/angular-cli#1814

@JonathanStoye
Copy link

FYI to whom it may concern: had a similar issue on macOS 10.14 on a MacBook Pro (15-inch, 2018) with Docker Desktop Community Version 2.0.0.0-mac81 (29211)

File changes were not detected anymore at some point even though it worked for quite some time. Seems like the docker engine was unhealthy and restarting the engine worked fine. After more testing it seems like the docker engine does not like sleep modus that much.

@dimitriy-k
Copy link

@JonathanStoye how did you fixed it? I have the same situation, wrapped angular-cli in docker, but it is not rebuilding after file changes.

Have you added poll: 1000 to angular.json or just restarted docker? I have restarted docker, but it did not helpt

@JonathanStoye
Copy link

As I said I just restarted the docker engine and then it was fine again. In my case it was just the standby of Mac OS that seemed to cause troubles with docker

@francescobianco
Copy link

@micdahl @friism @thaJeztah @JonathanStoye @dimitriy-k My solution is create a clone of INOTIFYWAIT full bash based on polling using a diff screenshot of filesystem, please take a look and support it work perfect on WINDOWS systems
https://github.com/javanile/inotifywait-polling

@htuzel
Copy link

htuzel commented Dec 30, 2019

thanks @JonathanStoye

@madacol
Copy link

madacol commented Jan 21, 2020

This has been solved in the new stable release of Docker Desktop Community 2.2.0.0

https://docs.docker.com/docker-for-windows/release-notes/#docker-desktop-community-2200

Docker Desktop now supports inotify events on shared filesystems.

@joelharkes
Copy link

Just upgraded to docker 2.2, currently having issues that changes are no longer detected..

@thaJeztah
Copy link
Member

There were some regressions in the Docker Desktop 2.2 release. I don't have a direct link to specific issues at hand, but they should be present in https://github.com/docker/for-win/issues

This issue is specific to Docker for Windows / Docker Desktop (not something that can be addressed in this repository)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants