I am developing an ASP.NET Core application to be run in Docker. During development, I would like the container to connect to SQLEXPRESS running on my development machine, which is also my docker host. However, as best I can tell the container cannot reach the host at all. I am unable to connect to SQL or ping the host IPs from the container. I am able to run the app local on my host and connect to SQL Server just fine, so I suspect if I can get it where I can ping the host from the container, I could connect to SQL.
The host has an ip of 10.0.0.5 on the main adapter, and ip of 172.30.96.1 on the "HNS Internal NIC", which I think is the one Docker is using.
To test basic connectivity, I tried to ping from inside the container:
docker exec -i containername cmd
c:\app ping 10.0.0.5
Request timed out
c:\app ping 172.30.96.1
Request timed out
Based on some similar posts, I have also tried to connect to a "host" network, but this isn't available for this version of docker, apparently. I suspect this is more for linux:
docker run --net="host" ...
network host not found.
I also found a similar Windows 10 post which suggested a "transparent" network. With this network, I couldn't connect in or out:
docker network create --driver transparent trans --gateway 10.0.0.1 --subnet 10.0.0.1/16
docker run --net=trans ...
docker exec -i containername cmd
c:\app> ipconfig
IPv4 address: 10.0.205.104
c:\app> ping 10.0.0.5
Request timed out
c:\app> exit
ping 10.0.205.104
Request timed out
Here's my docker info:
Containers: 1
Running: 1
Paused: 0
Stopped: 0
Images: 10
Server Version: 17.03.2-ee-5
Storage Driver: windowsfilter
Windows:
Logging Driver: json-file
Plugins:
Volume: local
Network: l2bridge l2tunnel nat null overlay transparent
Log:
Swarm: inactive
Default Isolation: process
Kernel Version: 10.0 14393 (14393.1593.amd64fre.rs1_release.170731-1934)
Operating System: Windows Server 2016 Datacenter
OSType: windows
Architecture: x86_64
CPUs: 4
Total Memory: 8GiB
Name: danielsdev5
ID: XLTN:PBAQ:BU7C:BMR6:O2VJ:DQKQ:P7TY:6QR7:NWEI:GEIF:OFND:ZVFE
Docker Root Dir: C:\ProgramData\Docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false