Replace docker with podman on MacOS

Docker wants to bill companies for Docker Desktop. In my opinion it’s not worth it because there are multiple options how to replace it without the need to really change habits. Here the statement taken from Docker FAQ regarding payment for Docker Desktop:

Who’s required to pay for Docker Desktop?

Docker Desktop requires a paid, per-user subscription for organizations with more than 250 employees or more than $10 million in annual revenue per our terms of service., 2022-12-03

Podman is an open source and free replacement licensed under Apache-2.0. Here the description of it taken from the homepage:

Podman is a daemonless, open source, Linux native tool designed to make it easy to find, run, build, share and deploy applications using Open Containers Initiative (OCIContainers and Container Images. Podman provides a command line interface (CLI) familiar to anyone who has used the Docker Container Engine. Most users can simply alias Docker to Podman (alias docker=podman) without any problems. Similar to other common Container Engines (Docker, CRI-O, containerd), Podman relies on an OCI compliant Container Runtime (runc, crun, runv, etc) to interface with the operating system and create the running containers. This makes the running containers created by Podman nearly indistinguishable from those created by any other common container engine., 2022-12-03

To install it I simply followed these steps on my Mac:

brew install podman
podman machine init # create a qemu virtual machine
podman machine start # start it
export DOCKER_HOST='unix:///Users/manuel/.local/share/containers/podman/machine/podman-machine-default/podman.sock'

With this in place you can continue running docker commands as usual and for most users a simple alias will do the trick if you don’t want to write podman instead of docker.

In IntelliJ you need to configure the TCP socket instead of Docker for Mac in the settings. Then also IntelliJ continues talking to the podman instance as it were a Docker Desktop. I named my host “Podman” instead of “Docker” and right-clicking the compose file and selecting “Run on Podman” worked like a charm. No difference to Docker Desktop before.

When you don’t need docker / podman you can stop it by running

podman machine stop

To restart it simply write “start” instead of stop.

Here is what I added to my .zshrc file:

alias docker='podman'
export DOCKER_HOST='unix:///Users/manuel/.local/share/containers/podman/machine/podman-machine-default/podman.sock'