0

A RESTFUL API depends on a SQL Server database so I am trying to use a SQL Server Linux container as shown here.

API app dependents on a database (mcr.microsoft.com/mssql/server:2017-latest-ubuntu), so I ran this docker command in Windows PowerShell:

docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=yourpssword" -e "MSSQL_PID=Express" --name sql1
-p 1433:1433 -d mcr.microsoft.com/mssql/server:2017-latest-ubuntu

Linux -DB Container is created successfully and running as below by Docker ps -a in Windows PowerShell https://uploads.disquscdn.com/images/9221f417a654aca4ec2fe923ca3743c6f447772bd8b853583fe2312ea012aef2.jpg

But when I tried to connect to the newly created database container with SSMS, I get this error:

https://uploads.disquscdn.com/images/8c09b0d4c863769f4c810d2a167ce17cc2227a7e63b57a58504d5159a6eb614a.jpg

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible.

Please help - am I missing something else?

Thanks,

1 Answers1

0

After spending some time, i found out below web page, it helps me to resolve the above problems.. https://tomssl.com/running-microsoft-sql-server-on-a-linux-container-in-docker/

I am using Windows 10 pro and docker host for development envr. For connecting sql-db Linux based container with SSMS tool, we Need to change docker DB port so we delete the existing container and again recreate sql-db container as below and run command at power-shell

docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Pa$$w0rd2019' -e 'MSSQL_PID=Developer' -p 1401:1433 --name sql2017 -d microsoft/mssql-server-linux:2017-latest

Now i am able to connect to docker sql DB by SSMS as below enter image description here

Thanks,