Hi,
I’m rather new to Docker, and am using the stable release of Docker for Mac on my laptop (mid-2012 MBPr, latest OSX 10.11.6).
I’m wondering if it’s possible to access the services provided by a dockerized app, via the IP address of the container?
For example, I can pull and run the nginx image no problem. I can run with the -p 80:80 settings and access http://localhost just fine, and i will see the nginx homepage.
But I don’t want port forwarding.
So I just do docker run -d --name nginx-test nginx to create my container.
Now, using docker inspect <name>, I can see that my nginx container is running on the bridged network, at 172.17.0.2
I want to access http://172.17.0.2 from my host machine (my Mac).
But every time I try to curl that IP or hit it via a web browser, I get nothing - no connection, no response, nothing.
I’ve spent days searching google, asking on twitter and various slack channels. Everyone keeps assuming i’m just trying to use port mapping with the -p option, and it’s really frustrating me. I don’t want port mapping / forwarding. I want to access the containerized app’s services by it’s IP address.
So, is it possible to use the 172.* IP address of a docker container from my host machine? If so, what am I doing wrong / missing?
Thanks!
- Derck

