Docker Community Forums

Share and learn in the Docker community.

Localhost ports not working after upgrade to beta 9


(Dylangrafmyre) #1

Expected behavior

Successful connection to rabbitmq container port from assigned ENV=localhost:5672 from dependent container.

Actual behavior

Connection refused to localhost:5672

Information

OS X: version 10.10.5 (build: 14F1713)
Docker.app: version v1.11.0-beta9
Running diagnostic tests:
[OK]      docker-cli
[OK]      Moby booted
[OK]      driver.amd64-linux
[OK]      vmnetd
[OK]      osxfs
[OK]      db
[OK]      slirp
[OK]      menubar
[OK]      environment
[OK]      Docker
[OK]      VT-x
Docker logs are being collected into /tmp/20160428-135855.tar.gz
Most specific failure is: No error was detected
Your unique id is: 2BF0214B-5378-4DA8-9572-024D592D08FA
Please quote this in all correspondence.

pinata get native/port-forwarding == true

Everything worked before the upgrade using the IP assigned to Docker.local.

Now when I assign AMQP URL to localhost within running dependent containers the connection is refused to the assigned port on localhost.

The rabbitmq container is running properly and I can curl and access the management web url from the mac via localhost:15672. However, other running containers connecting to the rabbitmq container server fails connection.


(Dylangrafmyre) #2

Here are my running containers. The webserver port 80 is published.

I can curl the nginx container from my mac using localhost, but connection refused from the preprocessor container using localhost?

Using the docker inspect webserver IPAddress works no problem when using curl http://172.17.0.2 from another running container.

So somehow the new localhost implementation is broken for me.


(A2daj) #3

Can you connect to the rabbitmq container via name from the preprocessor container? Usually, a container will see localhost as itself instead of the host.


(Dylangrafmyre) #4

Ok, maybe I am confused by the major changes with the upgrade to with beta9?

Docker.local is not used anymore and we are using localhost instead. Before when I exec into a running container, I cloud ping Docker.local and is resolved to the ip locally for development env 192.168.64.4. You would also see the same ip listed under PORTS when using docker ps just like the above is showing localhost port forwarding.

I just assumed this would be the same for setting env URLs for my app running in the container that needs to connect to the rabbitmq container. As long as you had localhost and the port assigned port it would resolve to the container that was publishing that port?

Only using the xhyve VM IP works for connecting to rabbit from the preprocessor. Exactly how it was before with Docker.local when not linking the containers via a docker-compose.yml or docker run --link=.

I guess just misunderstood the new usage of localhost replacing Docker.local.

THanks for replying!


(Kurt Madel) #5

Not perfect, but you can map the name of the container you need to link to 127.0.0.1 in your /etc/hosts file.