How to run SQL Server 2017 in docker on Windows 10

We use Microsoft SQL Server Express for our projects. Our engineers work on different platforms, like Windows or Mac. To solve the associated problems with the different platforms, we use docker for our database. This article describes how to set up an SQL Express DB with docker on Windows 10.

Download and install Docker Desktop

https://hub.docker.com/editions/community/docker-ce-desktop-windows

Check if docker works

Open a command-line terminal and run

docker version

Switch to Windows containers

Switch to Windows containers. From the Docker Desktop for Windows menu, you can choose which daemon (Linux or Windows) the Docker CLI talks to. Select Switch to Windows containers to use Windows containers.

Pull and install SQL Server 2017 Express

docker container run -e ACCEPT_EULA=Y -e SA_PASSWORD=Password1$ -e MSSQL_PID=Express -p 1433:1433 -d microsoft/mssql-server-windows-express

Password for user SA is set to “Password1$”.

View Running container and logs

docker container ls

When Status is “UP”, everything works fine.
If status is “Exited (1)” there is a problem which can be investigated with logs:

docker container logs adoring_jennings

“adoring_jennings” is the auto generated name of my docker container.
Example log output:

Get the IP-Address and connect with SQL Server Management Studio

docker inspect --format '{{.NetworkSettings.Networks.nat.IPAddress}}' eloquent_germain