Running CentOS 7.

I have a container that exposes the port 15672. It runs the management panel for rabbitmq, so curl should fetch the login page if I just ran curl on the address.

This is the output of docker ps -a:

4e183234a288 rabbitmq:3.7-management  ... 4369/tcp, 5671-5672/tcp, 15671/tcp, 25672/tcp,>15672/tcp

My IP for this box is (by running docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' 4e18) is

However, curl gives me the following error:

[root@server work-dir]# curl
curl: (7) Failed connect to; Connection refused

However, if I use the gateway (fetched using docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' 4e18), it works:

[root@server work-dir]# curl
<!doctype html>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>RabbitMQ Management</title>

This is the ouput of netstat -nr:

[root@server mitter-equities]# netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface         UG        0 0          0 ens224     U         0 0          0 ens224     U         0 0          0 docker0     U         0 0          0 br-093cf4da3140   U         0 0          0 br-18dc05c33da8   U         0 0          0 ens224

The network that the container runs in is br-18dc05c33da8 which is declared separately with a subnet

What I really want is my local port to be bound to this bridge network. However, when I do that:

[root@server ~]# curl localhost:32768
curl: (56) Recv failure: Connection reset by peer

When running with the exact same setup on my local machine (Arch Linux), I am able to curl using both the gateway and the localhost (same port that docker picked).

My question is:

  1. How do I get CentOS to bind that to the local port? I want this port to be exposed publicly as it exposes an external service. The port 32768 is exposed (right now it is an ephemeral port that docker picks up. I am just testing this setup. Once it works I will fix the port number), but traffic from outside cannot reach the docker container.
  2. Why does the IP of the container not work? Doesn't my system already know that for IP addresses in the gateway is

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.