Configure Microsoft SQL Server using Docker and Azure data studio

I have just started working on a new project, and the Microsoft SQL Server is being used for the project. But I am using Mac as my primary development machine at this moment, and I don’t want to switch to Windows now,  just for using the SQL server.

Docker is here to rescue you.

SQL Server image is available in the docker hub; you can check the docker image details at

After finding the SQL Server docker image, the second concern was, which GUI client to use for accessing SQL Server, as SQL Server Management Studio(SSMS) does not work on mac. After researching for a few minutes, I have found the easiest option. Azure Data Studio will solve my problem here.

Here is the easiest config and process that you can use for SQL Server on Docker and Azure Data Studio.

Run SQL Server Docker Container

I have kept the configuration as simple as possible. If you want to use any specific version of SQL Server, check the available options from

Run Container

Use the following command to run SQL Server docker container-

docker run --name sqlserver -p 1433:1433 -e SA_PASSWORD=some2Complex7Password -e ACCEPT_EULA=Y -d

Let’s check the details of the provided options for “docker run” –

–name sqlserverName of the container. After creation, the container will be named “sqlserver” in this case.
-p 1433:1433This is config for port. This option means exposing port “1433” of the docker container to port “1433” of the host machine. As we know the SQL server will run on port “1433” of the container. So we are exposing it to the host machine, so that we can access it from the host machine.
-e SA_PASSWORD=some2Complex7Password-e” is for the environment variable. Here we are setting value for “SA_PASSWORD” which is the password for the “sa” user.
-e ACCEPT_EULA=YThis environment var is set to confirm the acceptance of the enduser license of SQL Server.
-dThis is for running the container in detached mode. image name

Config using Docker Compose

If you want to run it using docker-compose, then here is the docker-compose.yml file for SQL Server.

version: "3.9"
        image: ""
            SA_PASSWORD: "some2Complex7Password"
            ACCEPT_EULA: "Y"
            - "1433:1433"

In the configuration, set the password in the environment value SA_PASSWORD and in the ports section, you can set the port you want to expose the service to. I have kept the default port 1433.

Use the following command to run –

docker-compose up

Run your Docker container and then config Azure data studio following the instructions below.

Azure data studio configuration

Download Azure data studio from . Go to add a new connection, and you will see a form like below.

Azure Data Studio setting for SQL server running on Docker
  • Connection type: Select “Microsoft SQL Server” from the dropdown.
  • Server: enter “localhost,1433” in the field. Make sure to enter the port which you have in the docker configuration.
  • Authentication type: Select “SQL login” from the dropdown.
  • User name: enter “sa” in the field as the user name.
  • Password: enter the password that you set in the docker config file. In my case, it is some2Complex7Password.
  • Remember Password: check this checkbox.

NOTE: There is a comma(‘,’)  between the localhost and the port number. So use a comma(‘,’) there, do not use a colon(‘:’).

I have kept all other fields to the default value.

Click on Connect button, and you should be connected to the SQL server. You should see a screen like the below.

Azure data studio does not have all the options of SQL Server Management Studio(SSMS), but it will get the job done.

That’s it, done.

Leave a Comment

The reCAPTCHA verification period has expired. Please reload the page.