A utility to help with development within Docker containers on OSX and WIN.
Containers run on OSX through docker-machine or boot2docker are running within a virtual machine. Files can be shared between OSX and the container through shared volumes or NFS. This allows the developer to continue to use their editor of choice while building and running their code inside the container.
Unfortunately, Virtual Box/Parallels does not trigger inotify events within the container when a file is modified on the OSX host. This issue is described here: https://www.virtualbox.org/ticket/10660 https://www.virtualbox.org/ticket/14234
Workflows that rely on inotify events to trigger build processes are limited by this issue.
inotify-proxy is a small utility to restore these build processes. It polls for filechanges, then touches those files again inside the container, triggering the necessary inotify events.
You can build this image and use it beside you other containers to create file change events when adding it in this way:
my_service:
image: my_service
volumes:
- ./ui:/app
ports:
- "80:80"
inotify-proxy:
build: https://github.com/lvyuanjiao/inotify-proxy.git
volumes:
- ./ui/src:/app
Once running, inotify-proxy will initially list all of the files it is monitoring. When one of those files changes the name of the changed file will be displayed. Any build processes running in that container and listening for changes on that file will be triggered.
To reduce the overhead of polling for changes, polling is only run once per second.