If you’ve been anywhere near social media this week, you may have seen that Microsoft has announced SQL Server 2019. As a SQL Server enthusiast, I always get excited about new versions and the plethora of features and improvements they bring. However, installing a preview version of SQL Server on my local machine can be a hassle, especially when I don’t want it to be there permanently. This is where containers come into play.
Containers allow us to run a copy of SQL Server without it touching our local machine. In this blog post, I will guide you step-by-step on how to install Docker and get an instance of SQL Server 2019 up and running.
Step 1: Install Docker
First, go to the Docker Store and download the Docker for Windows Community Edition (CE). Although registration is required, it grants you access to the Docker Hub, which is a valuable resource. Once downloaded, double click the .msi file and accept the default setting of Linux containers. This will enable you to run SQL on Linux on Windows 10.
After the installation is complete, you will be prompted to log out and log back in. Once you do, Docker will start automatically and scan your system to verify that the prerequisites, such as the hyper-v and containers feature, are all in place. If any prerequisites are missing, Docker will prompt you to install them. After your system restarts and you log back in, Docker will start automatically.
Now, you can run your first Docker command! To keep it simple, let’s check the version of Docker that is running:
docker versionIf you receive a client and a server version in response, you’re good to go!
Step 2: Pull the SQL Server 2019 CTP Image
Next, you need to pull the SQL Server 2019 CTP image. In this example, we will use the Ubuntu image. Run the following command:
docker pull mcr.microsoft.com/mssql/server:vNext-CTP2.0-ubuntuOnce the image is downloaded, verify that it is on your machine:
docker imagesStep 3: Run the SQL Server Container
Now, it’s time to run the SQL Server container. Execute the following command:
docker run -d -p 15789:1433 --env ACCEPT_EULA=Y --env SA_PASSWORD=Testing1122 --name testcontainer mcr.microsoft.com/mssql/server:vNext-CTP2.0-ubuntuAfter running this command, the container will start running. To check if the container is running, use the following command:
docker ps -aNow, you can connect to SQL Server using “localhost,15789” and voila! You have an instance of SQL Server 2019 CTP 2.0 up and running on your local machine.
If this has piqued your interest in learning more about containers, I have compiled a list of all the blog posts I’ve written on the topic. Feel free to explore and have fun with SQL in containers!
Thanks for reading!