How to connect Docker with Azure Data Studio?
Asked Answered
C

5

11

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.

Compel answered 5/11, 2018 at 8:41 Comment(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. learn.microsoft.com/en-gb/sql/azure-data-studio/…Compel
C
25

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.

Concrescence answered 12/1, 2019 at 18:39 Comment(2)
After a lot of minutes wasted, this solution worked best for meReward
WTF: xkcd.com/927 I spent some time to find this solutionFolsom
M
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!

Maltzman answered 26/9, 2019 at 21:34 Comment(1)
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.Hypomania
D
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,

Diploma answered 1/4, 2019 at 8:6 Comment(1)
I don't have option for username/password but only Account.Rasia
O
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

Overplay answered 20/2, 2019 at 1:55 Comment(0)
S
0

If you use Azure data studio

server: 127.0.0.1 (not use localhost, don't need add port (1433) 

127.0.0.1:1433 because by default is 1433)

Authentication type: SQL login

Username: sa

Password: ***

And by the way Mircosoft sql server managerment is same

Sutphin answered 29/1 at 15:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.