docker - Docker 容器连接到 MSSQL:昨天工作
问题描述
我是 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 企业版、docker for windows、TSQL。我还尝试了https://canyouseeme.org/并确认我的 IP 上未打开端口 1433。
编辑:我可能应该注意到我仍然能够访问sqlcmd
容器内部的 repl docker exec -it mySecondServer "bash"
,然后再进入容器/opt/mssql-tools/bin/sqlcmd -S localhost -U SA
内部。
编辑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...
解决方案
推荐阅读
- scala - 在 playframework 中从 sass 引用 webjar
- c# - 垃圾收集如何处理超出范围的对象?
- node.js - 如何为不同的环境发布 npm 包?
- java - 不断遇到 FileNotFoundException (eclipse)
- javascript - HTML 网格在我的网页右侧创建了令人讨厌的边距
- javascript - 如何在 node.js 和 mysql 中使用多个 SQL
- jenkins - Jenkins Job 状态为 SUCCESS 但 Ansible playbook 失败
- go - golang sync.Map Range 函数线程安全吗?
- javascript - 在 MediaRecorder 中的多个 webrtc 流之间交换
- java - 我想让两个数组具有相同的值