I am late to the party with this post due to other projects and work taking up nearly all of my time, but its one I have been to write for a while.

Who would have though that after I first wrote about Docker back in early 2014;

https://media-glass.es/docker-516afc902732

that I would be writting a post like this …

Microsoft SQL Server 2016 on a Mac, using Docker

Given that I don’t use Windows much I thought it would be interesting to see how simple it would be for me to install and use the latest version of MS SQL.

First of all you need to ensure that your Docker installation has at least 4GB of RAM assigned, as I am running Docker for Mac, all that I need to do is open up the Preferences and change the memory to 4GB;

Once you have done that it turns out getting things up and running is really simple, all you have to do is pull the image from the Docker Hub by running;

docker pull microsoft/mssql-server-linux

and then launch it by running the following command;

docker run -itd 
 --name mssql 
 -e 'ACCEPT_EULA=Y' 
 -e 'SA_PASSWORD=P@$w0rd!123' 
 -p 1433:1433 
 microsoft/mssql-server-linux

Thats it, no messing about, just accept the end user agreement and set a secure password.

Great, now what? Well Microsoft have helpfully provided a command line client you can install on macOS by running;

npm install -g sql-cli

If you don’t have Node.js install you can install that using Homebrew;

brew install npm

Once installed you should be able to connect to your MSSQL container by running the following;

mssql -s localhost -u sa -p 'P@$w0rd!123' -e

Its not just MS SQL, there is .NET Core as well

Its not just Microsoft SQL server, they have been hard at work getting .NET core over to Linux as well, I can remember the days when to get .net running on Linux you had to use something like the long dead Chill!soft ASP or Mono.

Now it is as simple as running;

docker run -it microsoft/dotnet:latest

This will download and launch the latest .NET core container and switch to a session, from there you can run;

mkdir hwapp
cd hwapp
dotnet new
dotnet restore
dotnet run

To run a simple “Hello World”

Visual Studio on macOS and Linux

Add this this that you can also get an open source version VisualStudio on macOS & Linux which is actually really stable and not that different from Atom & Sublime Text and all of a sudden building apps in what was once a very (and I mean very) much a traditional Windows only domain is now available to all.

Now, I wouldn’t say that MSSQL is production ready, but Visual Studio Code is extremely stable and it was recently announced that the open source .NET core powers C# fucntions in AWS Lambda.

Following it becoming a platinum member of the Linux Foundation last month I think Microsoft is going to make 2017 a really interesting year for open source.

I guess that …

… after all.

Written by Russ McKendrick

I am he as you are he as you are me and we are all together

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s