Setting up SQL Server 2017 for linux on your computer with Docker

Setting up SQL Server 2017 for linux on your computer with Docker

Frequently, I need to set up lab environment and push/pull data from/to a SQL Server db, but I didn’t want to use an external one, but my computer (to work on the go), nor I didn’t feel like to install a full heavy SQL Server installation (including its required tons of components), so lately I’ve been testing SQL Server 2017 with Docker, and results were more spectaculars than I thought in the beginning.

This is a brief introduction on how to accomplish this (very very easy and clean); surely you can imagine applications for your daily work.

Hyper-v

As Docker images run over Windows Containers, I needed to turn Hyper-V feature on, all available settings. After reset, I was able to go to next step.

Setting Windows Features

Install Docker

(Requires Microsoft Windows 10 Professional or Enterprise 64-bit). After that, I restarted my computer again.

Installed Docker

Docker was now started properly:

Docker started

Configuring Docker settings

For SQL Server to run specifically, I needed to touch some settings: sharing my c: drive to save image changes and increase RAM Memory up to 4GB for SQL Server to start.

Docker settings menu

Docker shared drives

Docker advanced settings

Getting SQL Server 2017 for linux image

Once Docker is running, I pulled down SQL Server 2017 on linux image.

docker pull microsoft/mssql-server-linux:2017-latest

SQL Server 2017 docker image

Checked that new image is available for Docker to run, started it, and checked again from Docker that everything is running fine:

docker images
docker run -e "ACCEPT EULA=Y" -e "MSSQL SA PASSWORD=Pa$$w0rd" --name "sql01" -p 1433:1433 -v sql01data:/var/opt/mssql -d microsoft/mssql-server-linux:2017-latest
docker ps -a

SQL Server 2017 docker image downloaded

Then, used SQL Operations Studio to test everything is OK (if you want some details about this, just check this post

SQL Server Studio

Eloy Salamanca