Reputation: 3547
I have a script running inside a docker-container which listens for changes in a directory via inotifywait
. The directory is mounted to the host-system via docker -v
.
For some reason, inotifywait doesn't get triggered when files inside this directory is changed.
This is the problematic script-line
inotifywait -e create -e modify -e delete -e move /etc/nginx/sites-enabled
The container is started like this (via fig)
web:
build: .
ports:
- "80:80"
volumes:
- ./conf:/etc/nginx/sites-enabled
When I start the setup via fig up
, the script is executed, but changes in the mounted volume don't trigger the inotify-barrier.
Upvotes: 15
Views: 9382
Reputation: 371
You have to add -mq to your script like this:
inotifywait -mq -e create -e modify -e delete -e move /etc/nginx/sites-enabled
I have tested this solution and it works. The "m" is for "monitor" and "q" is for quiet.
Upvotes: 1