简体   繁体   中英

Windows 10 Docker Container Clients can't access SQL on Host

Set up is:

Windows 10 Pro 64 bit
All Hyper-V and Container features turned on
Full Sql Server, standard port 1433
Visual Studio 2017
Docker Community Edition Version 18.03.1-ce-win65 (17513)
Stock Windows 10 Firewall rules and security Polices
No additional anti-virus or security

I built a POC .net core 2.1 service in VS2017, added docker support. For test purposes I am trying to connect to the Sql Server from the service. I understand it runs in its own private network. When I run the service as a standalone outside of docker, it connects to Sql fine, so all that is working. Inside of the container it can't connect. I'm specifying the IP of vEthernet (nat).

If I turn off Windows Firewall, then it can connect. When I turn on firewall logging, I can see the packets are being dropped.

In network and sharing, my PC appears in the Network / Private Network group and the vEthernet (default switch) and vEthernet (nat) appear in the Unidentified / Private network group. Access type is No network access.

My PC is connected to the internet via a wi-fi router, so I don't want to open up a big fat security hole, but I'd like the container to be able to connect.

I can't specify the IP of the container since that is dynamic.

How should I set things up to let the containers connect to the Sql?

Maybe, Hyper-V is not connected to the local sever. Open Hyper-V Manager and connect to server...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM