See: Docker Express: Running a local SQL Server Express | by Maarten Merken | Agilix | Medium
- Start Container:
docker run -e "ACCEPT_EULA=Y" ` -e "MSSQL_SA_PASSWORD=MyPass@word" ` -e "MSSQL_PID=Express" ` -p 1433:1433 ` -d --name=sqlexpress.local ` -v tsql-seal:/var/opt/mssql ` mcr.microsoft.com/mssql/server:latest
Important: The example from Medium by Maarten uses the following switch to mount the docker volume:
-v tsql-seal:/var/opt/mssql.dataThis does not work with Docker named volumes. Instead use-v tsql-seal:/var/opt/mssql. See > Is it possible to create a volume with 'Microsoft SQL Server' docker container? - Stack Overflow
Optional: Add the container hostname (
sqlexpress-seal.local) to the hosts file in the local OS environment.
- Connect from SQL Server Manager
Server name: <HOST NAME>
Authentication: SQL Server Authentication
Login: sa
Password: MyPass@word
-
Install "Northwinds" database
-
Example connection string:
Server=<HOST NAME>,1433;Integrated Security=false;User Id=sa;Password=MyPass@word;Database=Northwind