When I graduated from college, one of the first computers I ever used was a MacIntosh. I loved the Mac, the user interface, and the overall footprint of that computer. I also started my career developing on UNIX systems with C++ and databases like Ingres. As I moved to other jobs, the PC was becoming very popular as was the Windows Operating System. When I joined Microsoft in 1993, I would embark on a 25 year journey working only on Windows laptops and Windows Server computers.
Last October we released SQL Server 2017 including support for Linux and Docker Containers. Since then, I have spent a great deal of my time talking to customers directly and at events about SQL Server on Linux. At one of these events in February in London (you may have heard of SQLBits), I was presenting on SQL Server on Linux and someone in the audience asked me this question. "Bob, I love what Microsoft is doing with Linux but I'm a MacBook user. I want to use my MacBook and run SQL Server on it". I thought for a second on this question and then came up with the idea of the "SQL Server Mac Challenge". I told the audience that with a reasonable internet connection, I could get any MacBook user up and running and connected to SQL Server with no Windows or Virtualization software in 5 minutes or less. The person in the audience took me up on my challenge and posted something on Twitter the next day that it worked!
Given my work lately on SQL Server on Linux, I asked my manager if I could get a MacBook so I could show off SQL Server to the MacBook user community. His answer was "of course!" Perhaps you are reading this and think this must be the Twilight Zone. Does this guy still work for Microsoft?
So here in this blog post, I will show you my journey in taking the SQL Server Mac Challenge. I'm happy to tell you it took only 4 minutes on my MacBook Pro.
First, you need to download Docker for Mac as seen on this screenshot of the website to download (https://store.docker.com/editions/community/docker-ce-desktop-mac)
The download is not too large and didn't take long on my internet connection. At the bottom right corner on my MacBook is an icon for downloads. I selected this to extract the downloaded image
When the image for Docker for Mac is extracted, a new window pops up so I can install it as an Application. I just used my mouse to drag the Docker icon on the Applications icon on this screen
When this completed, I selected the Launchpad application on the Dock and it shows the Docker application installed
I double-clicked the Docker Application. Now I see a new icon at the top status bar on my MacBook showing Docker is starting up
While Docker is starting up, I now decided to multi-task and download our new open-source, cross-platform tool called SQL Operations Studio. You can download the Mac version at https://docs.microsoft.com/en-us/sql/sql-operations-studio/download?view=sql-server-2017.
While SQL Operations Studio is downloading, I can pull the docker image for SQL Server. The steps for pulling docker images for SQL Server can be found at https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-linux-2017. Since the terminal for MacBook is a bash shell, I just ran this command in the terminal
docker pull microsoft/mssql-server-linux:2017-latest
Here is my terminal screen showing the docker pull in action
While the docker pull is now downloading the docker image for SQL Server, I went back to extract the SQL Operations Studio download.
If you look closely at this screen, the docker pull has completed so now I can start up a docker container with these commands:
docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=Sql2017isfast' -p 1401:1433 --name sql1 -d microsoft/mssql-server-linux:2017-latest
Notice the -p parameter which maps port 1433 to 1401. When I connect to this SQL Server I will use port 1401.
The result of this command looks like this. When this completes SQL Server is now up and running in a Docker container. Docker on Mac is a native Mac application.
Note: There is an issue with Docker on Mac and SQL Server using Host Volume Mapping. You can use data volume containers instead. See this note at https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-configure-docker?view=sql-server-linux-2017#persist and the github issue at https://github.com/Microsoft/mssql-docker/issues/12.
SQL Operations Studio has extracted so I'll select that to install it as an application and launch it. Again, SQL Operations Studio for Mac is a native Mac Application.
When SQL Operations Studio launches it pops-up a window for me to supply a server to connect to. I'll use the local IP address, port 1401, and the sa password I supplied when running the container
When I connect, SQL Operations Studio shows an Object Explorer and dashboard
I run a query by right-clicking the Server and select New Query
And now I'll run SELECT @@version to prove I can run a query
There you have it. I did this in less than 5 minutes!
So calling all MacBook users. Take the SQL Server Mac Challenge!