Using MS SQL on a MAC with .net5 and docker-compose
Oct 28, 2021
I am writing this more like a reference for myself as it is always a pain to set this up and play around with a starter project.
The docker-compose.yml file
version: "3.8"
services:
mssql:
image: "mcr.microsoft.com/mssql/server"
container_name: MS_SQL_Server
restart: always
environment:
SA_PASSWORD: "Pass123!"
ACCEPT_EULA: "Y"
volumes:
- mssql-data:/var/opt/mssql
ports:
- 1433:1433
volumes:
mssql-data:
driver: local
The app settings config
{
"ConnectionStrings": {
"MyAppConnectionString": "Server=localhost;Database=db_name;User=sa;Trusted_Connection=False;MultipleActiveResultSets=True;Password=Pass123!;"
},
}
Careful with trusted connection as setting it to true will not work :)