A tool to notify Docker contianers about changes in mounts on Bash for Windows.
Project description
This fork takes merofeev’s docker-windows-volume-watcher and makes it work with Bash for Windows (aka Ubuntu on Windows)
The 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.
Installation
This script can be installed with pip (both Python 2 & 3 are supported).
pip install docker-bash-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.
docker-volume-watcher
Monitor only bindings of container container_name.
docker-volume-watcher container_name
Monitor only binding of container_name in sub directory /not_node_modules.
docker-volume-watcher container_name /not_node_modules
You can also specify wildcards with * and ? characters. For example: monitor only bindings of containers with names containing myproject.
docker-volume-watcher *myproject*
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
File details
Details for the file docker-bash-volume-watcher-1.0.8.tar.gz
.
File metadata
- Download URL: docker-bash-volume-watcher-1.0.8.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38300a5e52af606031af33e5914618167971df0ed922c6afdd1ae7c1d7652e55 |
|
MD5 | 75510ea1fba0a99b68a6d82509159e8b |
|
BLAKE2b-256 | a9daef438b10f4dab80474ed7faeffbbcbb51c335cf56bbef90c8ca2cdd95063 |
File details
Details for the file docker_bash_volume_watcher-1.0.8-py2.py3-none-any.whl
.
File metadata
- Download URL: docker_bash_volume_watcher-1.0.8-py2.py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 522eea45d03b4b1e62209e3d10834c725bd23cb4fa0a687b961d9bfe5a6c7d0d |
|
MD5 | 0f11dc9592250374eda2bf94f500da3c |
|
BLAKE2b-256 | 1d0d2206541cdef430795976891ea04628bb3ba4d308d9120cc660cf935b1285 |