我正在尝试使用host.docker.internal
(按照https://docs.docker.com/docker-for-windows/networking/#use-cases-and-workarounds的建议)连接到在本地计算机上运行的SQL Server实例。host.docker.internal
已成功解析为IP,并且可以ping通
并且在防火墙配置中打开了端口 1433
错误消息
Connection refused 192.168.65.2:1433
我的连接字符串
Data Source=host.docker.internal,1433;Initial Catalog=;Persist Security Info=False;User ID=;Password=;MultipleActiveResultSets=True;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
docker 版本
Client:
Version: 18.03.1-ce
API version: 1.37
Go version: go1.9.5
Git commit: 9ee9f40
Built: Thu Apr 26 07:12:48 2018
OS/Arch: windows/amd64
Experimental: false
Orchestrator: swarm
Server:
Engine:
Version: 18.03.1-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.9.5
Git commit: 9ee9f40
Built: Thu Apr 26 07:22:38 2018
OS/Arch: linux/amd64
Experimental: true
Windows版Docker的
最佳答案
如果有人遇到类似的问题,这就是我的解决方法
如果仍然无法正常工作,还需要检查一些其他内容
关于sql-server - 使用host.docker.internal从docker连接到本地计算机(host)中的SQL Server,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50166869/