If you’ve been anywhere near social media this week you may have seen that Microsoft has announced SQL Server 2019.
I love it when a new version of SQL is released. There’s always a whole new bunch of features (and improvements to existing ones) that I want to check out. What I’m not too keen on however is installing a preview version of SQL Server on my local machine. It’s not going to be there permanently and I don’t want the hassle of having to uninstall it.
This is where containers come into their own. We can run a copy of SQL Server without it touching our local machine.
The post below will run through step-by-step how to install docker and get an instance of SQL Server 2019 up and running.
First, go to the Docker Store and download the Docker for Windows Community Edition (CE). Yes, unfortunately this is going to ask you to register but that gives you access to the Docker Hub which is pretty cool (for more info on that, see here).
Double click the .msi and accept the default setting of linux containers (yep, going to run SQL on Linux on Windows 10! For more information on this, check here).
You’ll then get the installation dialog: –
You’ll be asked to log out and log back in once the install is complete: –
Once you log back in, Docker will start automatically. It’ll scan your system to verify that the prerequisites are all there (the hyper-v and containers feature). If not, it’ll prompt you: –
Let your system restart and then log back in. Docker will start automatically: –
Now you can run your first docker command! I like to keep it simple and just check the version that docker is running: –
If you get a client and a server version back you’re good to go!
What you need to do now is pull the 2019 CTP image. I’m going to go for the ubuntu image so run: –
docker pull mcr.microsoft.com/mssql/server:vNext-CTP2.0-ubuntu
When that’s complete, verify that the image is on your machine: –
So now you can run a container!
docker run -d -p 15789:1433 --env ACCEPT_EULA=Y --env SA_PASSWORD=Testing1122 --name testcontainer mcr.microsoft.com/mssql/server:vNext-CTP2.0-ubuntu
N.B. – For more information on what’s going with this statement, check here
That’ll come back pretty much immediately, to check that the container is running: –
docker ps -a
Then connect in SQL using localhost,15789, and boom!
How awesome is that! An instance of SQL Server 2019 CTP 2.0 up and running on your local machine. If that’s peaked your interest into learning more about containers, I have put a list of all the blog posts I’ve written here.
Thanks for reading and have fun with SQL in containers!