Awesome work, thank you @merofeev, you’re a hero! I can confirm that docker-volume-watcher
(github) works perfectly on Windows 10 (Docker Toolbox w/ VirtualBox) with an alpine
docker container (node:6.17-alpine
in my case). This is the best solution; use native inotify
file notification events in Linux and then ensure your libraries or build scripts (e.g. gulp
) are not using polling at all. The end result is essentially 0% CPU usage vs. 30% CPU load (I’ve got a large number of files to monitor).
Note: From my research, I found that if you’re using grunt
(with grunt-watch-contrib
like I am) it will not appear to work, because no matter what, it’ll actually be using polling via node’s older fs.watchFile()
API. So ensure you’re using a library like chokidar
and after it indexes all the files you want to watch, it should sit fully idle and docker-volume-watcher
will dutifully notify chokidar
in your container using inotify
!
EDIT: There does appear to be one limitation, which is that docker-volume-watcher
isn’t capable of notifying about file deletion, which could be a potential problem for some. I’ve added an issue about that here: https://github.com/merofeev/docker-windows-volume-watcher/issues/16