I have a docker-compose.yml
file, that defines three services, using shared network. Network is defined only by name. docker network list
shows that it's a bridge
network. docker inspect network
gives the IP addresses (172.23.0.x
, with 172.23.0.1
defined as a gateway). My understanding is that this gateway
is my Docker host (a Windows 10 machine).
When I execute wget http://containerA-ip:PORT//
from bash
running in containerB, I get response alright.
When I execute wget http://gateway-ip:PORT//
from bash
running in containerB, I get response alright, too. (port PORT is published as PORT:PORT, so I assume that's the reason it works).
BUT. If I try to wget http://gateway-ip:OTHER-PORT
, where OTHER-PORT is a port number of some process that is listening on my Windows 10 machine, I get Connection refused
.
I wonder, is it FW configuration on my Windows machine, that's preventing this connection, or is it some Docker configuration/implementation detail that's preventing this kind of connection.
I was unable to find an answer to "how to connect to Docker host services from within a container using bridge
network" anywhere in the documentation..
Thanks to anyone, who could assist.
UPD: I've been suggested to check which interfaces this service is listening on, here's the output of netstat -na | grep 8088
:
TCP 0.0.0.0:8088 0.0.0.0:0 LISTENING
TCP [::]:8088 [::]:0 LISTENING
to verify it's the case, I've run curl --noproxy "*" -X POST "http://192.168.0.13:8088/"
and it produced expected response