Reputation: 532
I am starting with docker on windows and I am trying to use volumes for manage data in containers.
My host environment is a:
I've created a ngnix image using the following Dockerfile.
Dockerfile
FROM centos:6.6 MAINTAINER afym ENV WEBPORT 80 RUN yum -y update; yum clean all RUN yum -y install epel-release; yum clean all RUN yum -y install nginx; yum clean all RUN echo "daemon off;" >> /etc/nginx/nginx.conf VOLUME /usr/share/nginx/html EXPOSE $WEBPORT CMD [ "/usr/sbin/nginx" ]
I've created a ngnix container using the following command.
docker run -d --name nge -v //c/Users/src:/usr/share/nginx/html -p 8082:80 ng1 b738fef9cc4d135416a8cca4caf869acf944319b7c3c61129b11f37f9d891598
Then I go to my browser and I can see the web page:
However when I make a change on my index.html file it doesn't refresh on browser
Editing my file
On my browser (ctrl + f5)
I went to the VirtualBox machine to check if my shared directories options is ok.
Then I inspect my nge container with the following command.
docker inspect ng1
Docker inspect
What is happening with volumes? Why I can not see my changes?
Upvotes: 1
Views: 1813
Reputation: 532
After a couple of days I could find the solution.
Firstable docker on windows even on MAC uses a boot2docker instance on VirtualBox.
On MAC
On Windows
Next, the official docker's documentation says :
Docker Machine tries to auto-share your /Users (OS X) or C:\Users (Windows) directory
However, after find a solution I decided to change the default c/Users to another path just for keep order. With this in mind I did the following steps:
sudo mount -t vboxsf alias-name-virtualbox some-path-in-boot2docker # In my case (boot2docker instance) $ cd $ mkdir arquitectura $ sudo mount -t vboxsf arquitectura /arquitectura
# In my case (docker client) $ docker run -d --name nge -v //arquitectura/src:/usr/share/nginx/html -p 8081:80 ng1
Now it works.
Upvotes: 3