Docker on GitHub Actions macOS Runners (2022)

One of my GitHub Actions, mssqlsuite makes it ultra easy to install SQL Server on Linux, Windows and macOS runners. When working on the macOS portion, I was surprised that docker was not built-in.

Turns out, GitHub had to remove docker from the macOS images because of licensing issues.

Workarounds

One of the most popular workarounds was to install VirtualBox and run containers from there, but that took 5 minutes to setup every time it ran. I thought of suggesting podman, which is an open source container app that is a drop-in replacement for Docker. Just as I was about to file an issue asking GitHub to add podman, I noticed they added Colima which enables both docker and kubernetes.

Colima is an open source project that provides container runtimes on macOS (and Linux) with minimal setup, so you can run docker without having to install Docker for macOS and run into licensing issues actions/runner-images#2150.

Setup was incredible easy too! And faster. Now, installing SQL Server on macOS takes as little as 3 minutes.

Colima code

Getting docker going with colima is shockingly easy.

1brew install docker
2colima start

These two commands took a total of 1 minute and 20 seconds. Here's what it looks like in my workflow:

1brew install docker
2colima start
3docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=YourStrong@Passw0rd" -p 1433:1433 --name sql1 --hostname sql1 -d mcr.microsoft.com/mssql/server:2022-latest

Docker performed at the same speed for macOS -- about 2 minutes. Much better ๐Ÿ˜Š