Search code examples
macosnginxdockerboot2docker

nginx in Docker on OS X doen't reload html


I tried to use nginx on boot2docker with OS X. I hope to start a web server. I tried with command below;

docker run -d --name web -p 80:80 -v /Users/douglas/tmp/local_console:/usr/share/nginx/html:ro nginx

Then I changed the content of index.html, and curl $(boot2docker ip), but the index.html is not changed. I tried to stop and restart the container, still get the old page.

The most important question is, where was the old version html stored in docker nginx? I suppose it would not be stored in docker container, but why the nginx give me old content after I changed local html?

I tried almost same command on ubuntu 14.04 and it works fine:

sudo docker.io run -d -p 80:80 -v /home/vagrant/html:/usr/share/nginx/html:ro nginx

On both Ubuntu and OSX, I'm using same nginx image below:

REPOSITORY                      TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
nginx                           latest              4b5657a3d162        12 days ago         91.66 MB

Docker version is different

Ubuntu docker version:

vagrant@ubuntu-14:~$ sudo docker.io version
Client version: 0.9.1
Go version (client): go1.2.1
Git commit (client): 3600720
Server version: 0.9.1
Git commit (server): 3600720
Go version (server): go1.2.1
Last stable version: 1.4.1, please update docker

OS X docker version:

bash-3.2$ docker version
Client version: 1.4.1
Client API version: 1.16
Go version (client): go1.3.3
Git commit (client): 5bc2ff8
OS/Arch (client): darwin/amd64
Server version: 1.4.1
Server API version: 1.16
Go version (server): go1.3.3
Git commit (server): 5bc2ff8

Solution

  • Sadly, this is a known problem with the virtual box share that is created, and so far, we're lead to believe that the only possible resolution is to replace those shares with a real network filesystem, which will require quite a bit of work.