-
Notifications
You must be signed in to change notification settings - Fork 601
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
File system change events (inotify) support for mounted directories #615
Comments
As I already commented in the colima issue, I'm not sure this is a possibility at all (generating inotify events). Even if you capture them on the host (fsevents), I think you would need to implement a custom notification mechanism in the guest and can't expect to use inotify, which is a kernel mechanism. |
In far future we may support inotify with virtiofs (not virtio-9p-pci). |
There were some earlier series, about the various limits of inotify.
Previously we "solved" it by keeping the files locally on the VM. |
Looks like virtiofs is already supported (although marked as experimental), but I still can't get FS events working. Tools like |
Looks like Apple's virtio-fs document doesn't mention anything about inotify. Inotify in docker desktop container does work(although it would drop DELETE event, and inject additional WRITE event). docker.log shows messages like |
That shows that Docker is manually handling the notify events i.e. the feature is missing in virtiofs. |
Looks like so. I just tried qemu-virtiofsd on a Linux host, host to guest inotify doesn't work either(so it's not Apple's issue). There was some work trying to add inotify support for FUSE, but seems like it wasn't merged in mainline. |
I bet docker desktop watches files in host, and forwards events into guest(perhaps by invoking something like chmod/write). It might not be a great solution to do the same in lima. |
I'm trying to get node/next.js development working with colima, and next.js doesn't pick up changes I do on the host. However, if I So, as a (silly) workaround, maybe one can use a script or daemon in the container to continuously scan the files and touch any changed files? |
Yes, guest to guest inotify works as expected, but host to guest inotify doesn't(most likely because FUSE protocol doesn't support it).
As a personal workaround, that would work(just less performant, performance degrades linearly with the number of files being added). |
Yeah, it's not ideal at all. This is the easiest I could come up with, in case others need it:
The file system seems to only update about every 10 seconds, so changes aren't immediate. I'm using |
Some more testing reveals that running the script on the host is a lot more responsive:
|
This can help get hot reloading work when running sensei with a VM-backed Docker from a host file system folder. For example, when running sensei with Docker for Windows with the WSL2 back-end from a Windows file system folder (see #117) or when running sensei with Colima from a macOS file system folder (see lima-vm/lima#615). The recommendation still is to work off the VM file system to get native file watching.
I figure'd I'd reference another issue from the
|
You don't need to use the HEAD version. The latest regular version already supports |
option is here, but it does not work |
Linking the latest proposal by @balajiv113 |
Is it possible to use something like that with |
Description
From abiosoft/colima#151:
We're using Colima to run Docker in a VM on our macOS laptops. Colima uses Lima under the hood to run this VM.
Are there any plans to support file system change events for mounted directories through inotify?
This is a key feature for us as we use containers in scenarios like auto-reloading dev servers and re-running unit tests on changes.
If there are no plans to support it at the moment, what kind of effort would be involved in adding this? Depending on the effort required, we might be open to putting together a PR to add support for this.
The text was updated successfully, but these errors were encountered: