merofeev / docker-windows-volume-watcher

A tool to notify Docker contianers about changes in mounts on Windows.
MIT License
188 stars 30 forks source link

Add support for "delete" events (or elaborate more on why not possible) #16

Open patricknelson opened 5 years ago

patricknelson commented 5 years ago

I know this isn't currently built, however is it possible to propagate notifications on file deletions? I noticed that the documentation pointed out this limitation but I'd like to know if it's due to some issue out of the control of this library or maybe just due to time constraints.

patricknelson commented 5 years ago

Upon further research, it looks like an impossibility to do cleanly, since from what I can tell, the only way you can trigger an inotify event for a file deletion is to actually perform the file deletion from within the container itself. One workaround I'm thinking of could be an enormous hack, but:

Say we have C:\volume\ mounted in our container at /var/www/html:

  1. Receive notification that file C:\volume\file.txt was deleted in Windows
  2. Re-create empty file again at C:\volume\file.txt (again in Windows)
  3. Delete the file in the container via rm -f /var/www/html/file.txt (which would then trigger inotify).

What do you think? Too hacky? Too magical? 🎩✨