Home · RSS · E-Mail · GitHub · GitLab · Twitter · Mastodon

Replacing Docker Desktop with Podman Desktop on macOS

first published:

» Post Updates

» Setup

Install Podman Desktop, e.g. with homebrew:

brew install podman-desktop

Install the Podman Helper for compatibility with tools using the Docker socket.

sudo podman-mac-helper install

» Adjust the Podman Machine

The Podman Machine is the QEMU based virtualized machine which runs the underlaying Linux installation, necessary for the container runtime.

At the date of writing, the resources of the machine could not be adjusted using the GUI, only on the command line.

To do so, you might have to stop the machine first:

podman machine stop

and start it again after doing the changes:

podman machine start

When you want to create a smaller disk, you have to remove the old machine and create a new one:

podman machine rm
podman machine init --disk-size 30 --cpus 2 --memory 2048

Increasing the disk, adjusting the CPUs count, and memory can be modified without recreation:

podman machine set --disk-size 50 --cpus 4 --memory 4096

When you need to run priviledged containers which should be able to modify your (virtualized) host machine, you have to enable this explicitly:

podman machine set --rootful

» Redirecting the docker command to podman

First I tried to use an alias which will point docker to podman but as it turned out, aliases are not recognized in Makefiles. Instead, I’ve created a Bash script with the name docker in a folder which is part of my $PATH variable:

#!/usr/bin/env bash
set -euo pipefail
echo -e "${RED}WARNING: using podman${NO_COLOR}" 
podman "$@"

Lets assume I run the following command:

docker run -it --rm alpine

First, the script remembers me with a red hint that I’m running the command using podman and not docker, then it will simply execute podman followed by all the given arguments.

» Image Building

When building images with Docker which don’t have a registry in their tag, Docker will implicitly add a docker.io/ prefix to the tag. On the other hand, Podman will add a localhost/ prefix for those tags missing a registry and podman doesn’t want to be compatible with Docker here (Issue #1034). Thus, you have to add a docker.io/ prefix to the tag explicitly if you need this compatibility.

» Kind

For running Kind with Podman, you have to set the KIND_EXPERIMENTAL_PROVIDER=podman environment variable.

Loading images to your cluster won’t work the same way anymore:

kind load docker-image IMAGE_NAME

Needs to be replaced with:

kind load image-archive <(podman save IMAGE_NAME)

This might not be necessary anymore once unified image loading is implemented.

Home · RSS · E-Mail · GitHub · GitLab · Twitter · Mastodon