How to run containers without Docker Desktop for Mac running with Apple Silicon (ARM architecture)

Running containers on OSX, especially with Apple Silicon ARM architecture systems is a bit different than running natively on Linux. Applications like Docker Desktop for Mac made it very easy for the users and hid a lot of complexity for the user. Docker Desktop for Mac changed its terms of service which prevent people from using it working larger corporations without a paid subscription.

Commercial use of Docker Desktop in larger enterprises (more than 250 employees OR more than $10 million USD in annual revenue) requires a paid subscription.

Additionally, introducing ARM architecture on Desktop systems might be tricky. This article here should give some hints on using alternatives to Docker Desktop for Mac and how you can get it to work especially when you want to play with our OpenNMS Horizon container images.

If you want to run a container runtime like Docker, you need a system with a Linux kernel. On OSX this is done by running a Linux VM on your system. When you move the sliders for resource limits, like CPU, Memory, and Disk, you configure the resource limits for the Linux VM which runs all your containers.

A lightweight CLI toolkit to work with containers running on OSX can look like this:

  • Homebrew as the package manager to get the tools installed and up to date
  • Colima which can be used as a container runtime for OSX
  • Docker CLI tools and docker-compose
  • Some basic knowledge of how to work with a terminal instead a graphical user interface :slight_smile:

Step 1: Install Homebrew

Follow the installation instructions on

Step 2: Install docker, docker-compose and colima

brew install docker docker-compose colima

Set the path to your Docker host socket in your .zshrc by adding the following line:

export DOCKER_HOST=unix:///Users/${USER}/.colima/docker.sock

Apply the changes for your current terminal session with source ~/.zshrc.

:teacher: The default shell on Mac is zsh, if you use something different like bash you need to add the DOCKER_HOST variable in .bashrc instead. You can figure out which shell you are using by running the echo $SHELL command.

Step 3: Start a Linux virtual machine with a container runtime

This command will run a Linux ARM VM with 4 virtual CPUs, 16 GiB RAM, and a 40 GiB disk:

colima start --cpu 4 --memory 16 --disk 40

Instead of aarch64 which is the default, you can also use --arch x86_64 which gives you a VM with an emulated 64bit x86 architecture.

:biohazard: Be aware, that when you use the emulated 64bit x86 architecture is slow.

You can verify what underlying VM is running with a command like this:

docker run --rm -it busybox uname -m

:woman_facepalming: You can fix me, Iā€™m a wiki post.