Skip to main content

Docker Windows Volume Watcher

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.

Installation

This script can be installed with pip (both Python 2 & 3 are supported).

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.

docker-volume-watcher

Monitor only bindings of container container_name.

docker-volume-watcher container_name

Monitor only binding of container_name to host directory C:\some\directory.

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:\project\folder\.

docker-volume-watcher *myproject* C:\project\folder\*

Do not monitor files/directories matching *.git* and *build* patterns:

docker-volume-watcher -e "*.git*" "*build*"

If you experience duplicate notification issue (e.g. Duplicate notification - a single change triggers 2 notifications to the container), try event debounce feature:

docker-volume-watcher --debounce 0.1

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.

Metadata

Release files for docker-windows-volume-watcher 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docker-windows-volume-watcher 1.2.0
File Size Uploaded
docker-windows-volume-watcher-1.2.0.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for docker-windows-volume-watcher 1.2.0
File Interpreter ABI Platform
docker_windows_volume_watcher-1.2.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 15.8 kB

Release files / docker-windows-volume-watcher-1.2.0.tar.gz

Download URL docker-windows-volume-watcher-1.2.0.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e4618c1c43be367f1213ecdec5a84417002564a63f0ab2d9068447dbb3b44ccd
BLAKE2b-256 checksum
How to use checksums
bc9155d03a84b1ca9456cce06f575075d8e5428c5ff28218664c140dc7b5f414
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

Release files / docker_windows_volume_watcher-1.2.0-py2.py3-none-any.whl

Download URL docker_windows_volume_watcher-1.2.0-py2.py3-none-any.whl
Size 9.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
11b19d05ea2349ed8ee5f7dc5a129ee4dfb3995188c7636f5e54b36ca76df296
BLAKE2b-256 checksum
How to use checksums
3cd69aeb009a6ba93e24c1cdff619e4e538c36ade89cbed6f2238b816504e734
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.0

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page