I have a mounted volume on my mac associated with a docker container running a node app. Using nodemon to reload the app when it detects file changes. This seems to be very hit and miss. Can edit a file and sometimes it will detect the change and do a reload and sometimes it won’t. Pretty sure it’s not nodemon because if I actually do a docker cp of the local file to the container it reloads every time, without issue.
Just as an FYI, the files are definitely being changed as they should be using the mounted volume, can check the updated timestamp on an edited file and see that it’s reflected properly within the docker container.
Hi, I have the exact same problem with webpack-dev-server. It’s really annoying to have most of the times to restart my docker container in order to compile my files…
I’m not a nodemon user but I think --legacy-watch may poll the file system for changes which will probably consume excessive amounts of CPU doing file system accesses across the hypervisor. I recommend trying to use file monitoring solutions based on inotify which should work in Docker for Mac -v bind mounts.
Hey guys, I got the exact same problem and it was a mess to figure it out, but in my case it was the editor.
I use Atom (atom.io) and this editor has a weird RNG behavior if “Back Up Before Saving” option is set. There were a few more problems, like node_modules in the container weren’t found anymore after nodemon reloads the app. After uncheck this option, it all works like a charm.
If you don’t use Atom, try to test it with VIM or Sublime Text. With both I couldn’t reproduce the problem.