繁体   English   中英

我在Docker中创建了mssql-server-linux容器,但是无法从容器外部进行连接

[英]I created a mssql-server-linux container in Docker, but I can't connect from outside the container

我在Docker中创建了一个mssql-server-linux容器,该容器映射到主机上的端口4000。

现在,我正在连接到该数据库,但是出现错误。

我怎么解决这个问题?

错误信息

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or could not be accessed. Verify that the instance name is correct, and that SQL Server is configured to allow remote connections. (provider:named Pipes provider, error:40-Unable to open connection to SQL Server) A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or could not be accessed. Verify that the instance name is correct, and that SQL Server is configured to allow remote connections. (provider:named Pipes provider, error:40-Unable to open connection to SQL Server) 在此处输入图片描述

我建议检查iptables中的服务器端口是否处于接受状态。 也许您的服务器正在阻止或拒绝其他服务器。 并尝试ping您的服务器ip,以检查是否可以访问该服务器。

这是我尝试在MongoDB中连接Docker容器时的首次故障排除。

谢谢!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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