How I ended up using Colima for Docker on Apple Silicon
This year I got the chance to work with an Apple Silicon-based MacBook Pro, and what neat machines they are! Compared to my Dell XPS 9500, the difference is night and day. These ARM based devices are fast and cool (both literally and figuratively), whereas the XPS can often sound like a helicopter taking off. (It doesn't help that I got a device equipped with a 4K screen, but that's another story).
Because of the pricing change that happened back in August 2021, I couldn't use Docker Desktop that I suppose everyone got accustomed to throughout the years, so just like I did on Windows back then, I started looking for a replacement.
Podman
A lot of well-known Docker alternatives emerged at this point, the most commonly recommended of which must be Podman (along with Podman Desktop). This is what I use on my Windows machines, and this was the first solution that I tried on the Macbook as well.
The setup was pretty straightforward, as it usually is with Homebrew:
brew install podman-desktop
Everything was working flawlessly, especially with the podman-compose
extension installed, which allowed me to run compose files.
The first problems arose, when I needed to run a compose file, that contained x64 images. Even though, in theory, it should've been possible, it didn't matter how much time I spent on following various tutorials, reinitializing podman-machines, messing with QEMU flags, I just couldn't get the thing working.
Colima
While looking into the issue with Podman, I came across colima. Apart from being able to run AMD64 images out of the box, there were additional benefits to it, one of which was, unlike podman, colima could use Rosetta 2 for x64 emulation (which is significantly more performant).
Setup
The installation was pretty simple. First, you need to make sure that you have Rosetta installed:
softwareupdate --install-rosetta
Then just install colima, Docker and compose:
brew install colima
brew install docker docker-compose
Now you can start colima, but let's edit the machine defaults first. You can do both with the following:
colima start --edit
Now edit the configuration file that's just opened in your default editor. Make the following config changes to use :
vmType: vz
rosetta: true
mountType: virtiofs
# optionally adjust whatever else you want
# I suggest increasing the available cpu cores and RAM by editing `cpu` and `memory`
There! Now you can run all the Docker images you want by using the usual Docker CLI, since colima set itself up as a Docker context.
Drawbacks
Unlike docker-desktop or podman-desktop, you need to manually start colima every time you log off. You can work around this by using brew-services:
brew services start colima
Another disadvantage is that you don't get a GUI. Personally, this isn't a big deal for me, I opted for the -desktop
versions just because of the ease of installation (something something Windows user and GUIs) but I only ever used the CLIs anyway.
TL;DR
If you are an individual dev, you can use the good old Docker-Desktop
If you are a business user, and you want a GUI, use Podman-Desktop, unless you want to run x64 images
Otherwise, set up Colima
Originally published at https://marczin.dev on December 10, 2023.
Subscribe to my newsletter
Read articles from Daniel Marczin directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Daniel Marczin
Daniel Marczin
Using hashnode to syndicate my blogposts. If you want to read the latest posts, with my own design, visit https://marczin.dev/