How I Used Docker to Spin Up SQL Server on My Mac in 3 Easy Steps

Kiah Imani 🇧🇧 - Jan 18 - - Dev Community

Hi friends!

So, I recently kicked off a pretty cool 90-Day MVP project and guess what? I bumped into a bit of a snag – I needed to get SQL Server up and running on my Mac. Now, if you’ve ever tried this, you know it’s not the most straightforward task. SQL Server and Macs don’t usually play nice together, right? But don’t worry, I’ve got you covered. In this blog post, I’m going to walk you through the whole process, step by step.

Step 1: Install & Configure Docker

First things first: You need to install Docker. Here’s an article to help you do it.

Alright, before we jump into installing SQL Server using Docker, here’s a quick but important step – we need to give Docker a bit more memory to work with. Here’s how you do it: First, click on that little Preferences gear icon in the top right corner of your Docker app. Once you’re there, head over to the Resources tab. You’ll see a Memory slider – it’s usually set at 2 GB by default. Let’s bump that up to 4 GB.

Image description
Just slide that little guy over to the right. Done? Great! Now hit Apply & Restart. That’s it, Docker now has more room to breathe, and we’re all set for a smoother installation.

Step 2: Install & Setup SQL Server

Ok, folks, it’s go time! We’re now ready to download, set up, and get SQL Server running on your Mac. Here’s the game plan:

First things first, let’s open Terminal.

Once your Terminal window is up, you’re going to type in this command (it’s a bit of a mouthful, but you’ve got this!):

docker pull mcr.microsoft.com/mssql/server:2022-latest
Enter fullscreen mode Exit fullscreen mode

Hit Enter, and the download will kick off. Just hang tight for a bit.

After the download wraps up, it’s time to fire up your brand-new SQL Server image in Docker. Here’s the magic command you need:

docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=strongestPasswordEver123%'-p 1433:1433 -d mcr.microsoft.com/mssql/server:2022-latest
Enter fullscreen mode Exit fullscreen mode

A quick note: by typing ACCEPT_EULA=Y , you’re giving a thumbs-up to Docker’s end user license agreement.

And voilĂ , SQL Server should be humming along on your machine. To double-check, click the Docker icon in your menu bar and peek at the Dashboard.

Image description

Step 3: Install Azure Data Studio & Connect to Your SQL Server Instance

Next up: You need Azure Data Studio. Think of it as the Mac’s answer to SQL Server Management Studio (SSMS). Download it, then drag and drop the Azure Data Studio icon from Downloads to Applications in Finder.

Image description
Open Azure Data Studio and hit ‘New connection’. Since SQL Server is running on your Mac, just type localhost for the server. Your username is sa (that’s short for system admin), and the password is what you used in the Terminal command. In our little example here, that’s strongestPasswordEver123% .

And there you have it! You’re all set to rock and roll with SQL Server on your Mac.

Also, just a heads up – even though we’re all about getting Microsoft SQL Server up and running on macOS in this tutorial, there’s no reason you can’t use these same tricks for Docker on Windows or Linux. It’s pretty versatile like that!

And hey, if any of you out there are wizards at cross-platform development with .NET and have some cool tips or sneaky tricks up your sleeve, I’m all ears. Sharing is caring, right? Let’s make this .NET development journey easier for everyone!

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player