Colima

Last modified by Sebastian Marsching on 2024/10/24 12:42

Getting Started

Colima is an open-source alternative to Docker Desktop on Mac. It can easily be installed via Homebrew:

brew install colima docker docker-compose

By default, a virtual machine with 2 CPUs, 2 GB of memory, and 60 GB of storage is created. This can be modified through parameters to colima start.

colima stop
colima start --cpu 4 --memory 8 --disk 100

One can SSH into the VM where the Docker daemon is running with the colima ssh command, but usually this is not necessary. Instead, one can simply use the docker command directly in macOS like one would when using Docker Desktop.

The home directory is automatically mounted into the VM through SSHFS, so one can use bind mounts like the following one:

docker --rm -it -v $HOME/my-dir:/path-in-container image-name

Colima supports using Rosetta 2 for improved performance when running on ARM-based Macs:

colima start --arch aarch64 --vm-type=vz --vz-rosetta

Changing kernel variables with sysctl

For some applications (e.g. Elasticsearch) kernel parameters have to be changed with sysctl. In order to not have to do this manually everytime Colima is started, one can edit the Colima configuration using

colima start --edit

Inside the editor, one can then add code that is supposed to be executed on startup. For example:

- provision: []
+ provision:
+   - mode: system
+     script: sysctl -w vm.max_map_count=262144

Please refer to this GitHub issue for details.