10

I install docker container on mac(OS X) and install Microsoft SQL 2017 image file on docker.So, I try to connect docker with Azure Data Studio but didn't connect it. Can I connect docker with Azure Data Studio and How to configure it? Please help me, thank a lot.

kristianp
  • 5,496
  • 37
  • 56
Jonzz
  • 101
  • 1
  • 1
  • 4
  • 1
    Azure Data Studio is a cross-platform database tool for data professionals using the Microsoft family of on-premises and cloud data platforms on Windows, MacOS, and Linux. https://learn.microsoft.com/en-gb/sql/azure-data-studio/what-is?view=sql-server-2017 – Jonzz Nov 06 '18 at 03:10

4 Answers4

22

Use 127.0.0.1,1433 instead of 127.0.0.1:1433

This syntax is what my ASP.NET Core app uses as syntax so I figured MS liked that format for connection strings and such.

This worked for me. Hope it helps.

Gary Krause
  • 321
  • 3
  • 6
12

I was able to run SQL server on MAC using Docker by running it along with the Azure Data Studio.

In order to connect to a server, you need to go to preferences of your Docker settings and increase the Memory allocation from the default of 2GB to minimum 4GB (as SQL server needs min 3.25GB space). Save and restart the docker.

Once restarted, all you need to do is pull the docker image of the sql server and download it. this can be done by below commands on your terminal . FYI, I am using bash commands below:

Command 1:

sudo docker pull mcr.microsoft.com/mssql/server:2017-latest

This will pull the latest vesion docker image and download. Once done, you need to set your SQL authentication on the server for your database. Follow below commands:

Command 2:

   sudo docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=<SetYourPasswordHere>' \
   -p 1433:1433 --name sql1 \
   -d mcr.microsoft.com/mssql/server:2017-latest

This sets your password and uses the port 1433 for SQL server (which is the default port). To confirm if the image has been created and the SQL server is running on docker, execute the below command to check log(s).

Command 3:

docker ps

To check all instances in your history of dockers( i.e. if you already had dockers installed before you are attempting this SQL connection/execution), run the below command and it will give you all the logs of all instances you have created

Command 4:

docker ps -a 

or

docker ps -all

Once, you have completed above steps and see that the docker has created SQL instance, you need to go to Azure Data Studio and set the below credentials to access the server that you just created above using Docker.

Server: localhost
Authentication Type: SQL Authentication
Username: sa
Password: <Check Command 2 to see what you entered in the password where it says SetYourPasswordHere>

Hope this helps in your tryst with running SQL server on your MAC. All the Best!

Anchit
  • 141
  • 1
  • 5
  • I wish I could upvote this answer more than once. This is what I needed all along. PSA: Don't waste your time with AWS and RDS for SQL. – zeeple Mar 31 '20 at 02:49
3

You certainly can connect to a sql server image running in a docker container through azure data studio,

Based on the details mentioned in the question, I'm assuming that you have followed the steps on Microsoft docs for configuring sql server with docker,

The following command is needed to configure and run the SQL Server image docker container:

sudo docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=your-strong-password’ -p 1433:1433 -d mcr.microsoft.com/mssql/server:2017-latest;

To quickly verify

check that the image is running by running:

docker ps -a 

And checking the status column (with the correct instance name) to be 'UP',

Then launch Azure Data Studio and fill the connection details:

enter image description here

If you have followed all the default settings in setting up the image, this should work for you,

Hope this helps,

Saif Asad
  • 779
  • 10
  • 8
2

I hope first you have installed sql-cli(make sure you have node.js installed in your system),

Then connect to Mssql with command -> mssql -u -p

try to connect/create a database with docker first then connect from Azure Data Studio

Avdhoota
  • 451
  • 4
  • 20