无法连接到Azure上Ubuntu VM内的容器中运行的SQL Server

时间:2020-04-01 17:45:23

标签: sql-server azure docker ubuntu docker-compose

docker-compose.yml

version: "3"
services:
    coreapi:
        build:
            context: ./theapi
            dockerfile: Dockerfile
        ports:
            - "5000:5000"
    sqlserver:
        build:
            context: ./sqlserver
        ports:
            - "1433:1433"    
        environment: 
            - ACCEPT_EULA="Y"
            - SA_PASSWORD="Pwd12345!"
    angular:
        build:
            context: ./frontend
            dockerfile: Dockerfile
        ports:
            - "4300:4200"    

enter image description here

我在stackoverflow上读了类似的文章,并在我的VM上添加了打开的入站端口。

但无济于事:

enter image description here

编辑: enter image description here

1 个答案:

答案 0 :(得分:0)

NSG-入站端口规则->通过将值从1433更改为*,允许任何“源端口”连接到在Docker中运行的Sql服务器。

它将解决您的问题。我复制了您的步骤并转载了您的问题。此修复程序将解决该问题。

参考资料我曾经做过设置 https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-ver15&pivots=cs1-bash

注意:Docker中为Ubuntu提供了一个单独的MS Sql服务器映像。我相信您正在使用Linux映像。

我的sql服务器在ubuntu Az VM内部的docker中运行: enter image description here

我的Azure ubuntu VM配置: enter image description here

我的NSG入站端口规则: enter image description here

来自SSMS的连接:

enter image description here

连接详细信息: enter image description here