Open stefanfoulis opened 10 years ago
I am having the exact same issue. Same versions.. same behaviour.
I think it is related to the VirtualBox sendfile issue.
What solved it for me was adding sendfile off;
to the location tag in my site configuration.
Which is strange because I had it already disabled in my main nginx config (which used to work in the past).
same problem, mrmaxon's workaround works for me
same problem here, and it works with sendfile off;
I'm having the same issue, this really needs to be fixed
I had to restart docker-machine and after that all became ok: docker-machine stop default
I get weird file corruption when mounting
/var/www
into this container. It seems to be specific to nginx in combination with docker-osx (not sure if the same happens with other virtualisation countainers that mount stuff from the host machine into the VM). I could not reproduce this on a pure linux/docker host. I had this on MacOSX 10.9.4 and a fresh docker-osx install.All fine so far.
So far so good. Let's add something to the file
The new line is missing. Even stopping the container and starting a new one will not have the change show up.
And what is super weird, I can connect to the container with bash, run nginx in the backround and observe the files changing in the filesystem. But nginx does not pick them up.
but at the same time from the host:
Deleting the file gets picked up though
And now it gets interesting. Overwriting a file with a shorter content will show the content of the old file, but truncated at the length of the new file.
It looks like it's tied to the first request done with a new file. If you delete the file and make at least one request for that file and get a 404 and then re-add it, the new file contents will be picked up.
It seems to be a combination of docker-osx and nginx (I experienced this with the orchardup/nginx docker image as well. We did a quick test with an apache image, which did not show this behaviour.
My wild speculation: I suspect nginx is doing some deep magic in the way it detects file changes and caches it somehow (but apparently not just in memory, otherwise it would not survive container destruction and restart). Something with the docker abstraction of the volumes (and maybe just in combination of using a volume that was shared to the vm from the host os) and how nginx reads the files.
I'm linking this issue from docker and the official nginx docker image as well, as I'm not sure where the issue originates.
Some additional environment information: