Inotify events are not / stop working from host to container

Expected behavior

When creating / removing / updating a file / folder in a mounted folder, inotify events are triggered inside the container

Actual behavior

Under certain conditions, no inotify events are triggered.

Information

I encountered this issue while working on a sync project to increase the performance of docker volumes.

Basically, it launches an unison server in a container and performs syncs in realtime by watching two folders in the container: a normal one and one mounted to the host OSXFS. Syncing from the container to the host, always work. However, it looks like syncing from the host to the container stop / doesn’t work under certain conditions…

I tried to reproduce these conditions by creating a simple example that you can grab at GitHub - mickaelperrin/docker-magic-sync at feature/1.

Docker for Mac: version: mac-v1.12.0-beta20
OS X: version 10.11.5 (build: 15F34)
logs: /tmp/20160725-190835.tar.gz
[OK] docker-cli
[OK] app
[OK] moby-syslog
[OK] virtualization
[OK] menubar
[OK] system
[OK] osxfs
[OK] db
[OK] slirp
[OK] moby-console
[OK] logs
[OK] vmnetd
[OK] env
[OK] moby
[OK] driver.amd64-linux

Steps to reproduce the behavior

#1. get the example from Github
git clone -b feature/1 https://github.com/mickaelperrin/docker-magic-sync

#2. start the containers
cd docker-magic-sync/example
./compose.sh up -d --build

# 3. launch inotify in the container
docker exec -it example-magic_sync_1 inotifywait -m /src/project.magic

# 4. open a new terminal and go to subfolder example
touch newfile

# 5. check that no notification is emitted by inotifywait

# 6. ensure the file is created
docker exec -it example_magic-sync_1 sh -c "test -f /src/project.magic/newfile && echo 'No events were emitted but file was created'"

Beta 21.1 has been released which should resolve this issue. Thanks for your report and reproduction and for your participation in the Docker for Mac Beta!