Quick instruction on running MSSQL server in a Docker container

*** Download and install an image of MSSQL 2019 ***

docker run -e “ACCEPT_EULA=Y” -e “SA_PASSWORD=YourStrongPassword” -p 1433:1433 --name yourDBname --hostname yourDBname
-d Microsoft Artifact Registry

*** Connect SQL Server Management Studio to your Docker container ***

Server type: Database Engine
Server name: 127.0.0.1,1433
Authentication: SQL Server Authentication
Login: SA
Password: YourStrongPassword

*** For restoring db backups ***

// Create a backup folder
docker exec -it yourDBname mkdir /var/opt/mssql/backup

// Copy your .bak file to correct destination in the container
docker cp yourBackupFile.bak yourDBname:var/opt/mssql/backup

// Place the data files in correct folder on restore example:
/var/opt/mssql/data/yourBackupFile.mdf
/var/opt/mssql/data/yourBackupFile_log.ldf

*** Connectionstring from VS ***

connectionString=“Pooling=true;User Id=SA;Password=YourStrongPassword;Database=yourDBname;Server=127.0.0.1,1433”