Posted on

Running SQL Server in a Docker Container on a Mac

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.

3 thoughts on “Running SQL Server in a Docker Container on a Mac

  1. Thanks Kendra!! As it turns out this is going to help me out a great deal.

  2. Thanks Kendra this is pretty great 🙂

    Out of interest what is you mac vm setup? Do you keep your vm images on a seperate ssd? Im really struggling on my macbook pro for resources with only one vm running in fusion

    1. I use the local SSD built into the laptop. I typically allocate enough memory to the VMs so that SQL Server is pretty set for read-cache, given the data sizes I work with. During write intensive periods the fans kick on, but I can still do other things while it’s happening. This did get MUCH better when I upgraded recently, though. (The newer model is also way faster at rendering video, which is another big plus for me.)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.