Docker容器连接到MSSQL:昨天工作

时间:2019-08-20 15:33:56

标签: docker tcp docker-for-windows

我是Docker的新手,感到非常困惑。昨天,我设置了一个MSSQL docker映像,它正在运行。 docker ps -a的一些输出:

IMAGE: mcr.microsoft.com/mssql/server CREATED: 25 hours ago 
STATUS: Up 25 hours  PORTS: 0.0.0.0:1433->1433/tcp

我正在尝试远程连接以运行脚本。昨天我能够

sqlcmd -S <myIP>,1433 -U SA -P "<myPassword>" -i ./sql-scripts/all.sql -o "out.txt"

但是今天,当我运行相同的命令时,我得到了

Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : TCP Provider: No connection could be made because the target machine actively refused it.
.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..

有人知道今天和昨天之间会发生什么变化吗?使用Windows 10企业版,适用于Windows的docker,TSQL。我还尝试了https://canyouseeme.org/,并确认我的IP未打开端口1433。

编辑:我可能应该注意,我仍然可以使用sqlcmd然后进入docker exec -it mySecondServer "bash"来访问容器内的/opt/mssql-tools/bin/sqlcmd -S localhost -U SA repl。

编辑2:今天发生了同样的错误,当我尝试重新启动docker容器时(仍然不是我想要的解决方案)

Error response from daemon: driver failed programming external connectivity on endpoint mySecondServer (9d...): Error starting userland proxy: mkdir /port/tcp:0.0.0.0:1433:tcp:172.17.0.2:1433: input/output error
Error: failed to start containers: 85...

0 个答案:

没有答案