This project provides a docker solution allowing running SQL Server on Mac (M1, M2, M3).
It setups SQL Server with database restored from local .bak file.
This is common scenario for setting up local database.
Allows connection from Azure Data Studio.
Project requires Docker to be installed download link
To connect to Server Azure Data Studio needs to be installed download link
In the root of the project run:
docker-compose up
or without logs in detached mode:
docker-compose up -d
At this point your server is running and you can connect to it from Azure Data Studio:
click new connection > complete form:
Connection type: Microsoft SQL Server
Server: localhost
Authentication Type: SQL Login
User name: SA
Password: MyPassword123
Trust Server Certificate: True
(other inputs can stay as defaults)
You should see on the left hand side connection to localhost and when expand Databases be able to see AdventureWorks2017
To close SQL Server run:
docker-compose down
Make it your own!
Replace .bak file in the root of this project to database backup you want to restore.
Update env variables in .env to your backup name and password you want to use.
you can separately build and run Docker:
docker build -t my-sqlserver .
docker run --name sql-bak -p 1433:1433 -d my-sqlserver
or if you want to override env variables:
docker run --name sql-bak -p 1433:1433 -e DB_PASSWORD=<YourStrongPassword> -e DB_NAME=<YourBakDBName> -d my-sqlserver
To run database restore command ( executed in entrypoint.sh ) you will need logical file names from .bak ( they might be different depending on snapshot ) see logger comment in entrypoint.sh with instruction how to log logical file names.