Tech, Cloud and Programming

Docker on Mac with Colima

|

Docker is almost an essential tool for developing applications in a devops environment. It allows easy context switching and grouping. The standard way of installing it on the mac via Docker Desktop was free, but since 2021 it's a payed subscription model for companies > 250 workers with a minimum of $5/month.

Docker for Mac consists of a few parts

  • Docker Commandline tools (opensource)
  • Docker GUI for manage config and running containers (commercial)
  • Docker Machine, a virtual image to run the containers on mac.

The cli tools can be installed freely with brew install docker. The GUI i don't care that much for. I just want to run the containers. There is a deprecated tool: docker-machine which spins up a virtual machine inside virtualbox. There is quite some overhead and configuration required to make it working. Lucky there is colima

Colima

CoLiMa stands for Containers on Linux on Mac and is an extension on the LiMa (Linux on Mac) project. It's an optimized way to run a virtual linux on mac without having to install Virtualbox.

Via homebrew: brew install colima, you you use macports or nix, check the documentation.

Configuration

Run colima start on the first run it create and download the virtual image. By default it's a 2 Cpu, 2GiB and 60Gib storage virtual machine. Note all the docker containers run inside this virtual machine, you make sure you have enough resources assigned. You can change the default with this options colima start --cpu 1 --memory 2 --disk 10

Colima doesn't require any other configuration/settings to make it work with the docker tools. Any tools/api with work out of the box and doesn't release it's not the "official" docker desktop.

Daily usage:

Make sure you start it with colima start and stop when not needed with colima start. Then you can use docker pull , docker run ....

Alternatives

There are some alternatives i didn't give full attention.

  • Rancher Desktop is a gui based version. More targeted to run k8s on windows/mac. I didn't try it
  • Podman similar to colima, but i found it hard to setup before. It could be improved.