Search code examples
nginxdockerboot2dockerfig

Boot2Docker/Fig mounted volume not refreshing


I am using fig to mount my OS X directory through the boot2docker host vm. I am using the already provided Users directory. Try the following:

/code/Tryme.txt - "Hello there"

  1. Volume: /Users//code:/code
  2. Start up an nginx server and serve the code from /code.
  3. Get the file via nginx: content is "Hello there"
  4. Change the content of the Tryme.txt - "Hello foobar"

  5. When you get the file again, you get the original text: "Hello there"

So What am I missing? Any ideas? If I take the container down and bring it back up, the file is as it should be. When I nsenter the image, the file is changed as it should be as well.

Ideas?

Thanks.

Update: I have seen this as well with my application code serving the file up and it still doesn't change. I wanted this to be a dev environment for quick turn around, but it doesn't seem to work like expected.


Solution

  • You might want to add this configuration in nginx:

    sendfile off;
    

    Personally, I avoid serving anything out of a shared folder because of these types of inconsistencies. Run a simple watch script that kicks off an rsync inside your container from your shared folder volume to a container-only volume whenever anything changes. Then, have nginx serve from your container-only volume (/var/www below). Example fig:

    volumes:
     - ~/code:/code
     - /var/www