inotifywait in docker-container doesn't register changes

房东的猫 提交于 2019-12-10 12:49:18

问题


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.


回答1:


(Just because I saw boot2docker tag) Are you sure your container can see the file changed ? If you wrote on your host, it will be an inotify event on your mac, not on the VM that runs docker daemon.

TL;DR : boot2docker ssh touch /file/on/mounted/volume



来源:https://stackoverflow.com/questions/27917187/inotifywait-in-docker-container-doesnt-register-changes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!