To use MSSQL in Mac OS, we will need have a Docker installed in your local machine.
If you don’t already have Docker, download and install it, as follows:
Download Docker from the Docker official website, make sure you downloading the Mac Apple Chip installation file.
Once downloaded, open the .dmg file and drag the Docker.app icon to your Applications folder as instructed.
Launch Docker, you might be prompted for your password.
Installation
From the terminal, run:
docker pull mcr.microsoft.com/azure-sql-edge
This will download the container image to your local machine.
Once the download is completed, run:
# mount to specific host folder in local machine
sudo docker run --cap-add SYS_PTRACE -e 'ACCEPT_EULA=1' -e 'MSSQL_SA_PASSWORD=YourStrongPassword' -p 1434:1433 -v /Users/HappyCoder/workspace/docker-sql-mount-data:/var/opt/mssql/data --name sqledge2 -d mcr.microsoft.com/azure-sql-edge
# data not persists which is everything reside in the container
sudo docker run --cap-add SYS_PTRACE -e 'ACCEPT_EULA=1' -e 'MSSQL_SA_PASSWORD=YourStrongPassword' -p 1433:1433 --name sqledge -d mcr.microsoft.com/azure-sql-edge
Note: Do update the following parameters:
MSSQL_SA_PASSWORD - the sa password of the database to be created
--name - the docker container name to be created
Next, check whether the Docker Container is up
You should see the following example if it the container is up
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d000f354ee5b mcr.microsoft.com/azure-sql-edge "/opt/mssql/bin/perm…" 2 hours ago Up 2 hours 1401/tcp, 0.0.0.0:1433->1433/tcp sqledge
docker start sqledge
docker cp ./some_file CONTAINER:/work
docker cp CONTAINER:/var/logs/ /tmp/app_logs
docker cp CONTAINER:/var/logs/app.log - | tar x -O | grep "ERROR"