λ ryan. himmelwright. net

Install Podman on M1 Mac

test

Blowing Rock, NC

Ever since I started using macOS, and especially after purchasing an Apple Silicon Mac, I have been closely watching podman development around Mac support. After waithing for several patchs to hit upstream dependency projects, everything seems to now be in order. As a result of that work, I finally have podman running on my M1 MacBook Air.

Background

As a Fedora user, I love how well it supports podman. Over in macOS however, I was forced to use docker to run containers, as podman wasn’t well supported yet. This was particularly true for apple silicon Macs, like my m1 air.

Docker Desktop
Docker Desktop Application.

Additionaly, Docker reacently announced that ‘Docker Desktop’ would no longer be free for large enterprises. For mac users, the solution to this problem isn’t as simple as “just don’t use the desktop app”. In macOS, docker only runs using the desktop app. It is not possible to install just the command line service like on Linux (at least that was my understanding).

To be clear, this change is only for enterprise users. Still, it has prompted many people to look closer at alternatives (finally 😆). Right around the time of this announcement, I noticed much of the updates the podman team had been waiting for upstream, started to release.

So, I gave it a shot, and finally got podman working on my M1 MacBook Air!

Install

Before getting started, first make sure you have Homebrew installed. Then, install podman:

brew install podman

Note: I think you also need qemu and other dependencies installed, but homebrew should take care of that.

Podman Machine

In order to run containers on macOS, podman needs to install a Linux VM to run the containers in (I think docker does something similar on macOS). This is what podman machine is for. To create the VM, initalize podman machine:

podman machine init

Once the VM is created, start it up:

podman machine start

Note, the vm will have to be started to use podman, so this step might be required after a reboot.

Side Note: I had to use the Next branch VM

At the time, I had issues with my podman machine setup. I had the required version of podman (3.4.0) installed on my mac, but the Fedora CoreOS image podman machine pulls down for the VM didn’t contain that verson of podman yet. However, the upcoming release did (Fedora-CoreOS pushes an update about every 2 weeks), so I was able instructuct podman machine to use the next branch for the VM image, which worked.

This shouldn’t be an issue anymore, as it has been a few weeks since I initially did this and the current Fedora CoreOS release seems to have the correct version of podman.

To verify, you can ssh into the VM using:

podman machine ssh

and then check the podman version installed inside the VM:

[core@localhost ~]$ podman --version
podman version 3.4.0

This should be at least 3.4.0.

Running Some Containers

To test out podman, I spun up a fedora container and played around in it a bit:

podman run -it --name fedora --network bridge quay.io/fedora/fedora

Inside it, I ran some updates and installed a few packages. Everything seemed fine. Later on after my macbook had rebooted, I ensured that I could still start and podman exec into the same container:

podman start fedora
podman exec fedora /bin/bash

… which also worked perfectly!

Conclusion

Fedora Podman container running on macOS
Fedora Podman Container running on my M1 MacBook Air.

While it feels like it’s been a long time coming, I am so glad to have podman working on macOS, and specifically on Apple Silicon. This is important to see, especially at a time when Apple is pushing out such impressive hardware. It will be interesting to see if there cotinues to be an increasing shift towards podman over the next few years. I imagine being able to install it locally on Macs can only help…

Next Post:
Prev Post:

Obsidian Basics Pytest Parameter Tests