Docker in Mac M1/M2 - Colima!

Introduction

I’ve been recently doing some work around Docker in my M2 Mac to find the expected architectural issues. (So, not everything has worked as expected and The Rosetta plugin didn’t seem to work that well with some of the old pre-compiled containers).

Then.. I came across an emulator that simply did the job! That’s Colima.

 

What's Colima

Colima apart of a Mexican city, is a new tool that makes it easy to run Docker containers on macOS and Linux.

Colima is a third-party project that wraps Lima to provide an alternative user experience for launching containers. The key difference is that Colima launches Docker on Alpine VM by default, while Lima launches containered on Ubuntu VM by default.

We will be quickly explaining HOW to have both solutions running at the same time: Colima and Docker Desktop

Installation Process on your M1/M2 MacBook

The installation process, as of today has got a problem and it needs a light patching on your Mac as per the instructions below:

  1. sudo nano /etc/paths -> add /opt/homebrew/bin  on the top of the list

  2. restart your terminal or new session.

  3. arch -arm64 brew install lima -> This way I now have lima installed at:/opt/homebrew/bin/lima

  4. brew install colima

  5. colima start --cpu 2 --memory 4 --disk 50 --arch x86_64

Now your colima Virtualization is running and you can use Docker as per usual being 100% fully x86_64 compatible.

You have to remember the following:

  • Remember which Container Application you got running at the time, either Colima or Docker Desktop as it can get confusing (in essence everything looks the same)

  • You can have Colima and Docker Desktop running at the same time. They will overlap.
    If you start Docker Desktop and after Colima, the docker command will show you the Colima images, but if you close and open the computer, it will just show the images for the Docker Desktop. So, ensure you know what you have running at the time as it can get confusing.

 

Colima Commands

colima status
INFO[0000] colima is running using QEMU                 
INFO[0000] arch: x86_64                                 
INFO[0000] runtime: docker                              
INFO[0000] mountType: sshfs                             
INFO[0000] socket: unix:///Users/gonzalo/.colima/default/docker.sock 
colima start
INFO[0001] starting colima                              
INFO[0001] runtime: docker                              
INFO[0001] starting ...                                  context=vm
INFO[0062] provisioning ...                              context=docker
INFO[0064] starting ...                                  context=docker
INFO[0071] done   
colima stop
INFO[0000] stopping colima                              
INFO[0000] stopping ...                                  context=docker
INFO[0004] stopping ...                                  context=vm
INFO[0009] done   

Documentation

GitHub - abiosoft/colima: Container runtimes on macOS (and Linux) with minimal setup 

Docker Installation - DDEV Docs 

Back to Blog