Docker Community Forums

Share and learn in the Docker community.

New Mac OSX User Stymied with Nginx

(Rammjet) #1

Just started using Docker on Mac with Boot2Docker. Using installation guide:

Setup goes fine. Then I try the exercises.

$ docker run -d -P --name web nginx

The above works and I can see the Nginx message in my browser at “http://ip:port”

So, I try:
$ docker stop web
$ docker rm web
Then I make directory “$HOME/site” and place “index.html” in it
$ docker run -d -P -v $HOME/site:/usr/share/nginx/html --name mysite nginx
$ docker port mysite

This doesn’t work. When I go in the browser to "http://ip:port in Nginx, I get “forbidden”. If I try to directly access “http://ip:port/index.html”, I get “not found”.

Please point me in the right direction so I can proceed to learn about Docker.

(Rammjet) #2

OK, well I found an answer. Let’s just say my journey with Docker has been very rocky so far.

The answer to my problem above is that it only works if your $HOME directory is under /Users. I have my $HOME directory on a different partition, so instead of being /Users/rammjet I am /Volumes/Users/rammjet. The $HOME variable passes the correct directory, but it seems that the guest additions for Virtualbox are not configured to handle anything out of the ordinary. So, since it is a boot2docker issue, I guess I should have posted this in that part of the forum.

I found this answer in a Docker blog posting from Oct 2014 and I guess the restrictions have not been expanded:

I booted into another installation of OSX that has the $HOME directory under /Users and the exercises worked fine.