简体   繁体   English

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

[英]Unable to connect to SQL Server running in container inside Ubuntu VM on Azure

docker-compose.yml 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"    

在此处输入图片说明

I read similar post on stackoverflow and add opened inbound port on my VM.我在 stackoverflow 上阅读了类似的帖子,并在我的 VM 上添加了打开的入站端口。

But to no avail:但无济于事:

在此处输入图片说明

Edit:编辑: 在此处输入图片说明

NSG - Inbound port rule -> Allow any "source port" to connect to your Sql server running in Docker by changing the value from 1433 to *. NSG - 入站端口规则 -> 通过将值从 1433 更改为 *,允许任何“源端口”连接到在 Docker 中运行的 Sql 服务器。

It will resolve your issue.它将解决您的问题。 I replicated your steps and reproduced your issue.我复制了您的步骤并重现了您的问题。 This fix will resolve it.此修复程序将解决它。

Reference I used to do your setup https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-ver15&pivots=cs1-bash参考我曾经做过你的设置https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-ver15&pivots=cs1-bash

NOTE: There is a separate MS Sql server image in docker for Ubuntu.注意:Ubuntu 的 docker 中有一个单独的 MS Sql 服务器映像。 I believe you are using an image for linux.我相信您正在使用 linux 映像。

My sql server which is running in docker inside ubuntu Az VM:我的 sql 服务器在 ubuntu Az VM 内的 docker 中运行: 在此处输入图片说明

My Azure ubuntu VM config:我的 Azure ubuntu VM 配置: 在此处输入图片说明

My NSG inbound port rule:我的 NSG 入站端口规则: 在此处输入图片说明

Connection from SSMS:来自 SSMS 的连接:

在此处输入图片说明

Connection details:连接详情: 在此处输入图片说明

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

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