How To Install SQL Server On Windows Containers

Yay!! SQL Server on Windows Containers! Hey wait a minute, I thought you could already install Docker Desktop on Windows? Yes, but behind the scenes, Docker uses HyperV to create a Linux VM (called MobyLinuxVM). So even though it was on a Windows machine, it still used a Linux VM on the backend.

Today, Microsoft released Windows Containers, currently in the Early Adoption Program here. You can use the same Docker Desktop for Windows but now you can use Windows Containers to deploy SQL Server (as you will see below).

This is primarily for dev/test environments. This is in no way production ready. Think about a developer asking for a SQL instance so that they can run their code against, etc. You can now easily, and quickly, spin up a container running SQL Server. Once they are done, you can remove it or stop it.

This blog post will show you how to install SQL Server using Windows Containers.

Note: Prerequisite is that you are running Windows 10 on 1809, build 17763 or higher. You can check by running systeminfo at the command line and looking for “OS Version”. Minimum of 6 GB of disk space and 2 GB of RAM

First, you will need to install Docker Desktop for Windows.

Once you have that installed, right click the tray icon and choose, “Switch to Windows Containers” see image below.

SQL Server on Windows Containers

Note: When you install Docker Desktop for Windows it will default to using Linux containers. If for some reason you get any errors when trying to switch to Windows containers (as I did), uninstall and reinstall Docker Desktop for Windows.

Now that you have it switched to Windows containers, open up Powershell (Run as admin) and pull down the SQL Server image by running the command below:

docker pull private-repo.microsoft.com/mssql-private-preview/mssql-server:windows-ctp3.1

Once the image is downloaded you can run it with the following command:

docker run -e ‘ACCEPT_EULA=Y’ -e ‘MSSQL_SA_PASSWORD=YourPassword’ -p 1433:1433 –isolation=hyperv -e ‘MSSQL_PID=Developer’ –name sql1 -d private-repo.microsoft.com/mssql-private-preview/mssql-server:windows-ctp3.1

docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=YouPassword' -p 1433:1433 --isolation=hyperv -e 'MSSQL_PID=Developer' --name sql1 -d private-repo.microsoft.com/mssql-private-preview/mssql-server:windows-ctp3.0

After that is successfully executed, you can open up Azure Data Studio (or SSMS), and connect to ‘localhost’ using your sa login. Enjoy!

5 Replies to “How To Install SQL Server On Windows Containers”

  1. Hi Mohammad

    Very handy articles and to the point…
    I am just curious about if Containers can use to deploy SQL Server in production environment as I couldn’t hold on this piece of info yet thought ask here.

    Thanks in Advance

  2. “You can now easily, and quickly, spin up a container running SQL Server.” But we could already do that with Linux containers. Why would a developer care whether the SQL Server they spun up for local testing purposes is in a Linux or Windows container?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.