I'm running a container that's initiated by docker-container like so:
puppetboard:
build: ./images/puppetboard
image: puppet/puppetboard
ports:
- 5000:5000
links:
- puppetdb:puppetdb
It successfully builds and when I run docker ps
I can see:
0.0.0.0:5000->5000/tcp
I can even go into the container using docker exec
and use curl localhost:5000
which returns an html page.
I double check that host machine can see port 5000 on 127.0.0.2 (docker network) with nmap 127.0.0.2
and the port is available: 5000/tcp open upnp
.
Yet when I go to 127.0.0.2:5000
in my browser on the host machine I get website not available. How can I debug this network issue?
Result of curl 127.0.0.2:5000
& curl 127.0.0.1:5000
is: curl: (56) Recv failure: Connection reset by peer
.
127.0.0.x is a loopback address. For publishing ports in the container to the host, you need to listen on all interfaces in the container. So you'll need to make sure your app inside the container is configured to listen on 0.0.0.0:5000 (this is different from the option publishing the port in the docker compose file).
As we discuss it in this room, you have to ensure that the containerized application listen on all interfaces inside the container. In the puppet board case, config looks like :
DEV_LISTEN_HOST = '0.0.0.0'
0.0.0.0 is used to say "all interfaces"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With