Quickly test SQL Server using Docker
SQL Server is a large application. The installation copies lots of files and creates new services. If you want to test a version of SQL Server, you may not want to install it on your computer. Instead of creating a virtual machine, you can get a ready-to-run image from docker. This is much easier to install and, as a VM, it won't pollute your computer. Indeed, you can remove everything with just one command.
Install feature Container
Download and install docker tools
Switch to Windows container
Get the image you want: mssql-server-windows or mssql-server-windows-express
Shelldocker pull microsoft/mssql-server-windows docker pull microsoft/mssql-server-windows-express
Run the container
Shelldocker 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 run a SQL Server on you computer, you may need to change the port exposed by the container: replace
1433:1433
by<anotherport>:1433
Note 2: you must use a complex password or you won't be able to connect using the sa account
Check the container is started
Shelldocker ps -a
Connect using SQL Server Management Studio
First, you must download SSMS Then, you must get the IP address of the container:
Shelldocker inspect sqlserver | find "IPAddress"":"
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, you must recreate the container with a stronger password
Delete the container
When you want to delete the container, you have to run the following command:
Shelldocker 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 😃
Do you have a question or a suggestion about this post? Contact me!