docker-container中的inotifywait不会注册更改 [英] inotifywait in docker-container doesn't register changes
问题描述
inotifywait
监听目录中的更改。该目录通过 docker -v
挂载到主机系统。 由于某些原因,inotifywait不会在此目录中的文件更改时触发。
这是有问题的脚本行
inotifywait -e create -e modify -e delete -e move / etc / nginx / sites-enabled
容器是这样开始的(通过fig)
web:
build:。
ports:
- 80:80
卷:
- ./conf:/etc/nginx/sites-enabled
当我通过 fig up
启动安装程序时,脚本将被执行,但已安装的更改卷不触发inotify-barrier。
(只是因为我看到boot2docker标签)你确定你的容器可以看到文件已更改?如果你在你的主机上写过,那将是你的mac上的一个inotify事件,而不是在运行docker守护进程的VM上。
TL; DR:boot2docker ssh touch / file / on / mounted / volume
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.
(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
这篇关于docker-container中的inotifywait不会注册更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!