Docker Community Forums

Share and learn in the Docker community.

Accessing service hosted on the host environment from the container

For dev purpose, I have a service running in my host environment (localhost:8080, Windows 10) and I need to access that service from a windows container. However, network at my work blocks port 8080 and I have no control over it. I’m looking for a solution similar to what linux containers offer, such as accessing through host.docker.internal that uses loopback connection. I’ve been searching online in the past few days and the answer seems to elude me. Any input is appreciated!

Docker Compose : 3.4
Docker Desktop:19.03.2
Host OS : Windows 10 Prof.
Container : IIS

I’m going to answer my own question to serve as a reference for others. Seems that Docker binds host’s 0.0.0.0 with it’s Docker NAT ip. Inside window container, request to DockerNat ip seems to be redirected to 0.0.0.0. So one solution is - run your host service at 0.0.0.0 and use DockerNat_ip:8080 inside your container to interact with that service. To reveal that IPV4 address, execute ipconfig on your host machine and voila!

1 Like