A tool to notify Docker contianers about changes in mounts on Windows.
Project description
This script monitors directory bindings of Docker containers on Windows hosts and notifies containers about file changes.
The script aims to be workaround for the problem of file change events propagation on Windows hosts. Due to limitations of CIFS implementation in Linux kernel, file change events in mounted folders of host are not propagated to container by Docker for Windows. This problem renders watch mode of modern frameworks (e.g. Jekyll, ng-cli, etc.) development servers useless, since containers are not notified about file changes. This problem is described on [Docker Community Forums][community-forums].
[community-forums]: https://forums.docker.com/t/file-system-watch-does-not-work-with-mounted-volumes/12038
Installation
This script can be installed with pip (both Python 2 & 3 are supported).
`dos pip install docker-windows-volume-watcher `
Usage
Monitor all directory bindings of all containers. The script will listen for container start/stop events and notify all running containers about file changes. `dos docker-volume-watcher `
Monitor only bindings of container container_name. `dos docker-volume-watcher container_name `
Monitor only binding of container_name to host directory C:somedirectory. `dos docker-volume-watcher container_name C:\some\directory `
You can also specify wildcards with * and ? characters. For example: monitor only bindings of containers with names containing myproject to directories starting with C:projectfolder`. ```dos docker-volume-watcher *myproject* C:projectfolder* ``
Use flag -v to enable verbose output: the script will report start/stop events of eligible containers and print all detected file changes.
Limitations
The script doesn’t propagate to container file deletion events.
The script requires stat and chmod utils to be installed in container (this should be true by default for the most of containers).
Implementation details
The script uses watchdog package to observe file change events of the host directory. Once file change event is fired the script reads file permissions of changed file (using stat util) and rewrites file permissions with the same value (using chmod util) thus triggering inotify event inside container.
“Rewrite file permissions approach” was used instead of updating file last modified time with touch util. Since touching will cause event loop: touch will trigger file change event in Windows, script will handle this event and touch file again, etc.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for docker-windows-volume-watcher-1.0.0.zip
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef52544d4b818607a501dbe1bfa9beb8620161c365bb6467d97d009fc997c194 |
|
MD5 | 43ece626857da0985f9f82412e898fab |
|
BLAKE2b-256 | e639965c2fca268a13fd54fb5551f1ee98a6563ad5a3de62aaa075bc78ef5d0b |
Hashes for docker_windows_volume_watcher-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96be9b9a2d11e316ee680dbe61cee7f7c27faea6002e3f36bb44c20a6023f3d1 |
|
MD5 | 802347c4b16ea04972c02ede94a51c1f |
|
BLAKE2b-256 | b4bf3f1465f4c8d4fa1380831d58c90bc5956f569cd385bc650b95b65b99081d |