As the first step we need to install Docker Mac and make sure you have Rosetta get installed, in case of using Mac with M1 or M2. These Models come with Apple Silicon. Some of the older apps come with Intel chip support, Rosetta will help you the migrate to Apple Silicon.
Docker Compose
Using the Docker-Compose we can containerise MSSQL. Here is the working Docker-Compose file.
Create a Folder called MSSQL and add Docker-Compose.yml file with following contents
version: '3.9'
services:
mssql-azur-edge:
image: mcr.microsoft.com/azure-sql-edge
platform: linux/arm64
ports:
- 1433:1433
volumes:
- ~/apps/mssql/data:/var/lib/mssqlql/data
environment:
- ACCEPT_EULA=Y
- SA_PASSWORD=mssql1Ipw
Since I’am using the Mac Min M2, which is an arm device, should specify in the platform key. Port key expose the internal port to external. Volume indicate the storage location which is optional.
In the environment key we can pass the Password for SQL Server etc.
Now . Run the Docker-compose up -d. for running the Container. If there is any problem , run this command for the log docker-compose logs
You are ready to use the sever. You can also use the Mac IP and exposed port in SQL Management studio or in a connection string as (source)
Mac IP, 1433