It is quite simple to set up a local instance of SQL Server container with Docker on a Windows 10 machine.
Step 1: Docker
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.
Step 2: Updates
When the PC reloads, you may get an error. WSL2 needs an update. It will ask to restart. Restart your PC again.
Step 3: Firewall
When your PC Reboots, Windows firewall will ask to allow access. click to allow access.
Step 4: Powershell
Open up Powershell and run as admin, enter code below and press Enter to install.
docker pull mcr.microsoft.com/mssql/server:2019-latest
Step 5: Run
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:
We're building an AI-powered Product Operations Cloud, leveraging AI in almost every aspect of the software delivery lifecycle. Want to test drive it with us? Join the ProdOps party at ProdOps.ai.