It is quite simple to set up a local instance of SQL Server container with Docker on a Windows 10 machine.
Download and install Docker. Be sure all check boxes are checked off. You will need wsl installed. Once Docker is installed, it will ask you to restart your pc. Reboot your PC.
When the PC reloads, you may get an error. WSL2 needs an update. click the link provided, or click here . It will ask to restart. Restart your PC again.
When your PC Reboots, Windows firewall will ask to allow access. click to allow access.
Open up Powershell and run as admin, type in and press Enter to install
docker pull mcr.microsoft.com/mssql/server:2019-latest
Step 5. Once installed in powershell type
docker run -d -p 1433:1433 –name sql-server-2019-express -e “MSSQL_PID=Express” -e “SA_PASSWORD=MyTestPass@word” – e “ACCEPT_EULA=Y” mcr.microsoft.com/mssql/server:2019-latest
-p is the Port the SQL server will run on, the –name is the name of container, your SA_PASSWORD can be anything. Since this is locally done, no need to create logins.
To Connect to your new local SQL server
- Download and install Microsoft SQL Server Management Studio .
- Open up Microsoft Sql Server Management.
- A pop up Connect to Server or click File > Connect Object Explorer
- Fill in credentials
- Server type – Database Engine
- Server name – 127.0.0.1,1433 or localhost,1433
- Authentication – SQL Server Authentication
- Login – sa
- Password – MyTestPass@word
- Click Connect and you should be in.
If for some reason, you cannot connect, validate that your docker container is running: