Image illustration of whale sql server container with docker windows 10

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: 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.

Revelry image wsl2errorRevelry image exceptionRevelry image whatttodownload

Step 3: Firewall

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

Revelry image firewall

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

  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: Login – sa; Password – MyTestPass@word
  5. Click Connect and you should be in.
Revelry image mssql

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

Revelry image docker 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.