Revelry Labs

Unleashing Human Potential with Technology

How to set up a local SQL Server container with Docker – Windows 10

It is quite simple to set up a local instance of SQL Server container with Docker on a Windows 10 machine.

Step 1

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

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.

Step 3

When your PC Reboots, Windows firewall will ask to allow access. click to allow access.

Step 4

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

  1. Download and install Microsoft SQL Server Management Studio .
  2. Open up Microsoft Sql Server Management.
  3.  A pop up Connect to Server or click File > Connect Object Explorer
  4. Fill in credentials
    1. Server type – Database Engine
    2. Server name – 127.0.0.1,1433 or localhost,1433
    3. Authentication – SQL Server Authentication
      1. Login – sa
      2. Password – MyTestPass@word
  5.  Click Connect and you should be in.

If for some reason, you cannot connect, validate that your docker container is running: