Run SQL Server 2017 container image with Docker on Windows

Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications, whether on laptops, data center VMs, or the cloud.

In this article we will see how to download and install docker and use Docker to pull and run the SQL Server 2017 container image

Docker Universal Control Plane can be installed on-premises or on the cloud. Before installing, be sure your infrastructure has these requirements.

For Windows

Prerequisites

Download and install docker from the link

.

Stop,Start the Docker Demon

docker stop-service
docker start-service

Pull SQL Server 2017 windows image

PS C:\Users\Administrator> docker pull microsoft/mssql-server-windows-developer
Using default tag: latest
latest: Pulling from microsoft/mssql-server-windows-developer
3889bb8d808b: Pull complete
449343c9d7e2: Pull complete
08883151461d: Pull complete
bafeb45a72fc: Pull complete
f5c5aa235c5b: Pull complete
158fead2ffa0: Pull complete
746db9597cec: Pull complete
9e96edbd8781: Pull complete
c6dabab6234f: Pull complete
975d0dccd859: Pull complete
5b747cfb01b7: Pull complete
c77992bbfd0f: Pull complete
Digest: sha256:a3e77eb7ac136bf419269ab6a3f3387df5055d78b2b6ba2e930e1c6312b50e07
Status: Downloaded newer image for microsoft/mssql-server-windows-developer:latest

Downloaded images are saved at C:\ProgramData\Docker\windowsfilter

Once Image is pulled and extracted. Now run the Docker Image

PS C:\Users\Administrator> docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=P@ssw0rd" -p 1433:1433 --name sql1 -d microsoft
/mssql-server-windows-developer:latest
061301bb254d4c7f2382945fc3da88d7fc5f81c11323862be2a195d5f53dc1c3

To view your Docker containers, use the docker ps command.

PS C:\Users\Administrator> docker ps -l

CONTAINER ID        IMAGE                                             COMMAND                  CREATED             STATUS                    PORTS                    NAMES
061301bb254d        microsoft/mssql-server-windows-developer:latest   "powershell -Command…"   26 minutes ago      Up 24 minutes (healthy)   0.0.0.0:1433->1433/tcp   sql1


PS C:\Users\Administrator> docker ps -a

CONTAINER ID        IMAGE                                             COMMAND                  CREATED             STATUS                    PORTS                    NAMES
061301bb254d        microsoft/mssql-server-windows-developer:latest   "powershell -Command…"   27 minutes ago      Up 25 minutes (healthy)   0.0.0.0:1433->1433/tcp   sql1

Connect to SQL Server Server using SSMS with SQL Authentication, Alternately you can use Visual Studio code to create and run Transact-SQL scripts for SQL Server

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *