Reputation: 14586
I'm trying to develop a web app locally using native Docker for OS X (beta) to handle the entire environment.
In order to fake the production DNS configuration (to test Nginx setup) I have edited the host file (at /private/etc/hosts):
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
# Added by me
0.0.0.0 www.mydomain.com
The Nginx config file is tested and is working on production server.
Expected behaviour: When I point my browser to www.mydomain.com it should be redirected to ip 0.0.0.0 (Dockers default IP on OSX), and my containerized web app should appear.
Actual behaviour: The browser shows a "Failed to open page" error message.
What am I missing here?
Upvotes: 2
Views: 1618
Reputation: 1197
see https://github.com/docker/docker/issues/2509
the address you specified is inaddr_any , which is basically a wildcard. so your problem is with the /etc/hosts file - bind the domain name to a real ip of the host, e. g. 127.0.0.1
Upvotes: 1
Reputation: 9896
you docker-for-mac ip ist not 0.0.0.0 - nothing has this ip. Use 127.0.0.1 if you are using docker-for-mac.
Also ensure, when you start docker, that you export the ports to the host, either by docker-compose or by docker run adding -p 80:80
when starting your web-container
Upvotes: 1