Skip to content

While in Docker container, .NET app doesn't receive inotify notifications about changes in filesystem of mounted volumes. DirectoryWatcherWithPolling shows how to go over this problem.

Notifications You must be signed in to change notification settings

madameczek/directorywatcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Directory Watcher

While in Docker container, .NET app doesn't receive inotify notifications. If your app relies on FileSystemWatcher, which relies on inotify, your app will not be notified about changes in filesysem of mounted volumes.

DirectoryWatcherWithPolling class shows how to go over this problem. It uses PhysicalFileProvider class. It gives reliable solution for a problem of watching a folder for new files by containerized application. It is thread-safe and non blocking solution.

Code is simplified for demo purposes. In production, you may want to make the DirectoryWatcherWithPolling DI friendly, change callback to async or implement better way to distinguish a new file from an old one.

This is explained on my blog. In Polish, intentionally :)

About

While in Docker container, .NET app doesn't receive inotify notifications about changes in filesystem of mounted volumes. DirectoryWatcherWithPolling shows how to go over this problem.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages