Install Docker for SQL Server on a Mac

How to install Docker on your Mac and configure it for SQL Server.

Before you install SQL Server on a Mac, you need to install Docker. This is because the Mac installs (and runs) SQL Server from a Docker container image.

Below are instructions for downloading and installing Docker (it's pretty simple), then configuring it for SQL Server. By "configuring" I simply mean that you need to allocate enough memory to Docker so that SQL Server can run.

  1. Download Docker

    Go to the Docker Community Edition for Mac download page and click Get Docker.

    Docker CE for Mac download page
  2. Install Docker

    Double-click on the downloaded .dmg file and then drag the Docker.app icon to your Application folder.

    Docker CE for Mac installation screen
  3. Launch Docker

    Launch Docker the same way you'd launch any other application (via Launchpad, the Applications folder, etc).

    When you first Launch Docker, you might be prompted for your password. Go ahead and provide your password — Docker needs this in order to install its networking components and links to the Docker apps.

    Docker password request notification
  4. Increase the Memory

    SQL Server needs at least 3.25GB to run, but Docker only allocates 2GB by default. Therefore you should increase this allocation to allow SQL Server to run. Increase it to 4GB (to be on the safe side).

    To do this:

    1. Select Preferences from the little Docker icon in the top menu
    2. Select Advanced (if it's not already selected)
    3. Slide the memory slider up to 4GB
    4. Click Apply & Restart
    Selecting the Preferences dialog in Docker Increasing the memory allocated to Docker

Now you can Install SQL Server

Now that you've installed Docker and increased its memory allocation, you can go ahead and install SQL Server on your Mac.

What Exactly is Docker?

Docker is a platform that enables software to run in its own isolated environment. It achieves this through the use of "containers".

As explained on the Docker website:

A container image is a lightweight, stand-alone, executable package of a piece of software that includes everything needed to run it: code, runtime, system tools, system libraries, settings.

The main benefit of Docker containers is that they enable us to run software across different computer systems without encountering configuration issues. Because the software is running in its own isolated environment, all configuration settings are already included in the container.

Docker is a popular option for development environments, where software can be developed and tested without having to worry about whether all computers are configured the same. Containers isolate software from its surroundings, for example differences between development and staging environments and help reduce conflicts between teams running different software on the same infrastructure.

But as we can see with SQL Server, Docker can also be used to download and run software on a platform that wouldn't normally be able to run that software (such as running SQL Server on a Mac or Linux).

Why do we need to use Docker to run SQL Server?

Prior to its 2017 release, SQL Server wasn't available for the Mac. The only way you could run SQL Server on a Mac was to use a virtual machine such as VirtualBox, Parallels Desktop, VMware Fusion, or Bootcamp running the Windows operating system. To do this, you had to create the virtual machine, purchase Windows and install it onto that virtual machine, and then finally install SQL Server.

While this is still a viable option today, SQL Server 2017 has provided you with new option: Install SQL Server via Docker — without needing to purchase Windows. The Docker container image contains everything needed to run SQL Server.