Running SQL Server in a Docker Container on a Mac

on August 2, 2017

A user recently asked me what a good use case might be to run SQL Server on Linux in a Docker container.

I recently got started with SQL Server in Docker on my Mac, and I’m really excited about the potential.

Learn why and see how easy it is to rebuild your SQL Server on Docker once you have things configured in this 7 minute video:

In this video:

  • 00:10 - The use case I’m most excited about
  • 02:20 - Deleting all my Docker containers
  • 03:15 - Pulling the latest docker image for microsoft/mssql-server-linux
  • 04:15 - Using docker run to set up my container
  • 04:50 - Connecting to the docker container from SSMS installed in a VM running Windows

How to set up your Mac the first time

I got everything going on my Mac using Aaron Bertrand’s great article, VS Code on Mac meets SQL Server on Linux (in Docker).

Setup took me around an hour (with lots of breaks), and the only halfway tricky part was figuring out what IP address to connect to, since I have a different networking setup than Aaron does.

What if I don’t want to delete all my data?

In the video, I show clearing all your docker containers and grabbing fresh info. It’s definitely not a refined approach. If you’d like to be more civilized and update existing Docker containers, Jeremiah Peschka wrote about how to do that.

What if I want to run SQL Server in Linux in a Docker Container on Windows?

Start with the Microsoft Quickstart guide.