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.
You can modify shm size by passing the optional parameter --shm-size to docker run command. The default is 64MB.
According to the documentation however, there must be only one ENTRYPOINT in a Dockerfile.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With