SQL Server is a large application. Installing it copies many files and creates new services. If you just want to test a version of SQL Server, you probably don't want a full installation on your machine. Instead of setting up a virtual machine, you can use a ready-to-run Docker image. It is much easier to get started and, unlike a VM, it keeps your computer clean. You can remove everything with a single command.
Install feature Container
Install Containers feature
Download and install docker tools
Switch to Windows container
Switch to Windows containers
Get the image you want: mssql-server-windows or mssql-server-windows-express
Shell
docker pull microsoft/mssql-server-windows
docker pull microsoft/mssql-server-windows-express
Run the container
Shell
docker run -e ACCEPT_EULA=Y -e "SA_PASSWORD=RUc@ysd@f_P*yq4é" -p 1433:1433 --name sqlserver -d microsoft/mssql-server-windows
Note 1: If you already have SQL Server running on your computer, you may need to change the port exposed by the container: replace 1433:1433 with <anotherport>:1433
Note 2: You must use a complex password, otherwise you won't be able to connect using the sa account.
Check the container is started
Shell
docker ps -a
Docker ps result
Connect using SQL Server Management Studio
First, download SSMS. Then, get the IP address of the container:
Shell
docker inspect sqlserver | find "IPAddress"":"
Get the container IP address
Finally, you can connect using the IP address and the sa account.
Connect to the SQL Server server using SQL Server Management Studio
Note: If you get an authentication error, recreate the container with a stronger password.
Delete the container
When you want to delete the container, run the following commands:
Shell
docker stop sqlserver
docker rm sqlserver
If you want to recreate a new container, go to step 5. It will take just a few seconds to start 😃