Joseph Michael Pesch
VP Programming

SQL Server on Mac via Docker to Support .Net SQL Based Project

by 5. May 2020 17:50

To run SQL server on Mac using Docker, follow the steps below.

  1. Download, Install and Run the Docker Desktop Application for Mac: https://hub.docker.com/editions/community/docker-ce-desktop-mac/
  2. Open Terminal window and run the following statements:
    1. sudo docker pull mcr.microsoft.com/mssql/server:2019-CU3-ubuntu-18.04

    2. sudo docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD={PASSWORD_HERE}" -p 1433:1433 --name sqlserver -d mcr.microsoft.com/mssql/server:2019-CU3-ubuntu-18.04

    3. docker ps (to see running processes, or use the desktop application dashboard)

To initialize the SQL for .Net project:

  1. Create the following folder if it doesn't already exist: Users/{username}/.microsoft/usersecrets
  2. dotnet user-secrets init
  3. dotnet ef migrations script -i -o migration.sql
  4. dotnet dev-certs https --trust

VS Code Extensions:

  1. ms-dotnettools.csharp
  2. ms-mssql.mssql
  3. esbenp.prettier-vscode
  4. dbaeumer.vscode-eslint

Tags:

Mac OS | SQL Server