Daniel Gruszczyk
Daniel Gruszczyk

Reputation: 5612

Docker port binding doesn't seem to work

I am running an example from Docker tutorial:

docker run -d -P nginx

This starts correctly as docker ps outputs the following:

CONTAINER ID   IMAGE   COMMAND                  CREATED             STATUS              PORTS                                           NAMES
a5838f701c8f   nginx   "nginx -g 'daemon off"   3 minutes ago       Up 2 minutes        0.0.0.0:32773->80/tcp, 0.0.0.0:32772->443/tcp   compassionate_stallman

When I run docker inspect a5838f701c8f, I can see the IP of the container is 172.17.0.2.
However, for some reason going to localhost:32772 or 127.0.0.1:32772 or 0.0.0.0:32772 gives me ERR_CONNECTION_REFUSED. Going to 172.17.0.2:32772 just seems to endlessly load and load and never loads anything...
Could this be something with my host? I am using OSX 10.9.5 and docker 1.10.3, build 20f81dd.

Upvotes: 0

Views: 349

Answers (1)

Nguyen Sy Thanh Son
Nguyen Sy Thanh Son

Reputation: 5376

You should test with URL 192.168.99.104:32772 If you are using Docker Machine.

Please take a look with https://docs.docker.com/machine/reference/ip/ to know how to get IP address with Docker Machine

Upvotes: 1

Related Questions