Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Changes to a file belonging to a host mounted volume are not detected by nginx. #652
I'm using boot2docker 1.3.2 on OS X 10.9.5 and after starting boot2docker and exporting the environment variables I start docker with this command:
docker run -d -p 80:80 -v "$(pwd)"/html:/usr/share/nginx/html nginx
Where in "$(pwd)/html" I have a simple index.html file. Visiting http://192.168.59.103/ displays the page for "$(pwd)/html/index.html" (as expected), but changes made to "$(pwd)/html/index.html" are not displayed when reloading the page.
To force the changes to the file to appear on the page I find it is necessary to move "$(pwd)/html/index.html" to some other filename (index.html.moved for example), reload the page for which nginx generates a "403 Fobidden" error (as no index.html exists), then move the file back to its original location (i.e. mv html/index.html.moved html/index.html), after which reloading the page will show the changes made to index.html.
Is there a better way for changes made to a file in a host mounted volume to be detected by a processes running inside the docker container?
Thanks for the feedback. What I'm doing amounts to the steps described
As I'm using OS X, the mount I'm creating is "docker run -v
/Users/warren/Docker/nginx/html/index.html <--- on OS X
The change appears correctly in the Docker container, only nginx does not
Is this expect boot2docker behavior or not?
On Fri, Nov 28, 2014 at 2:07 AM, Sergey Zolotorev email@example.com
@CleanCut Since the bug is in
referenced this issue
May 22, 2015
@kudos I agree, it seems that everybody (on the 20+ threads I've found for various projects) is just assuming it's a Virtualbox issue because Virtualbox hasn't responded for years. However running stat shows the file being updated the the file contents are showing as updating, so I'm wondering what it is about sendfile or nginx, that is not picking up the change.
Some more info: http://smotko.si/nginx-static-file-problem/
referenced this issue
Oct 1, 2015
Same problem... But what I found out is:
... and, of cause, nginx, with default settings, returns version of file from VM...
UPDATED: After restarting the VM:
nginx returns 'Hi again to all of you' .
Still an issue for me using gulp on the host machine and hosting the index file on the client. I just run this bash script against the index file on the client machine for the time being:
#!/bin/bash ### Set initial time of file LTIME=`stat -c %Z $1` while true do ATIME=`stat -c %Z $1` if [[ "$ATIME" != "$LTIME" ]] then echo "" >> $1 echo "File Saved." LTIME=`stat -c %Z $1` fi sleep 3 done