Reputation: 1742
I have a java back-end hosted on my windows 10 machine(at localhost:8080). My front-end(.NET project) is hosted inside IIS container and it needs to communicate with the back-end. However, I cannot connect to the host from the container. I could ping the host's IP address with success. But when I use curl to access the host, it just fails with "Unable to connect to the remote server" error. An interesting thing is that I also have MSSQL server running on my Windows 10 machine and my front-end communicates with it using host's computer name without any issue.
Docker version 19.03.2, build 6a30dfc
Docker Compose 3.4
UPDATE
Turns out Port 8080 is blocked at my work. To rephrase my question, does windows container have host domain similar to what linux container offers - host.docker.internal?
Upvotes: 1
Views: 745
Reputation: 1258
If you're using docker-compose and you want to connect to your local host from a container you have to use the host.docker.internal
variable.
For example:
services:
service1:
network_mode: host
environment:
LOCAL_DB_HOST: host.docker.internal
Upvotes: 1