SQL Linux Docker 中的服务器实例字符串连接

SQL Server instance string connection in Linux Docker

我正在向 docker 图像 microsoft/dotnet:1.0.1-core 发布应用程序,该应用程序在连接字符串中引用 Sql 服务器实例:

"Data Source=host\instance;Initial Catalog=database;User ID=user;Password=pass;"

在 Windows 环境中它也可以工作,但是使用 docker,应用程序无法连接到数据库。将 Data Source 更改为使用 port 而不是 instance 它有效。

"Data Source=host,port;Initial Catalog=database;User ID=user;Password=pass;"

如何使用实例而不是端口从 docker 连接到 Sql 服务器?

According to Saurabh Singh from Microsoft:

The Instance name support is available in v 1.1 of .Net Core. In v1.0 of .Net Core, Instance names are not supported on OS other than Windows.

所以我认为您无法使用实例名称从 Linux 上的 .Net Core 1.0 运行 连接到 SQL 服务器。

您的选择似乎是: