Podman (the POD MANager) is a tool for managing containers and images, volumes mounted into those containers, and pods made from groups of containers.
This details the installation and setup of Podman on Linux and macOS as an alternative to Docker.
Important
Ensure the path to ~/.local/bin
is in your ${PATH}
environment variable.
-
Ensure you have
/etc/subuid
and/etc/subgid
, if you don't, create the files:sudo touch /etc/subuid /etc/subgid
and add a
subuid
andsubgid
:sudo usermod --add-subuid 100000-165535 --add-subgid 100000-165535 ${USER}
-
Write a bash script that helps fetch and install the latest
podman
release:nano ~/get-podman-launcher.sh
Add the following content to the
get-podman-launcher.sh
script:curl -Lo "${HOME}/podman-launcher-amd64" "https://github.com/89luca89/podman-launcher/releases/latest/download/podman-launcher-amd64" chmod +x "${HOME}/podman-launcher-amd64" mkdir -p "${HOME}/.local/bin" mv -f "${HOME}/podman-launcher-amd64" "${HOME}/.local/bin/podman"
-
Install
podman
by running the script:bash ~/get-podman-launcher.sh
Important
A portion of this guide assumes you are using the Fish shell. If you are using a different shell, make any required adjustments accordingly.
-
Install
podman
using Homebrew:brew install podman
-
To then use Podman, since
podman
only runs on Linux, you will need to create and start a Podman machine (VM).Create a Podman machine (do this only once):
podman machine init
Start the Podman machine:
podman machine start
-
To automatically start the Podman machine each time you launch a shell session, add the following to your shell profile (i.e.
~/.config/fish/config.fish
):# start podman machine if not running if status is-interactive # check if podman is installed if command -v podman >/dev/null # check if podman machine is running set machine_info (podman machine info) if ! string match -q "*machinestate: Running*" $machine_info # start podman machine quietly podman machine start >/dev/null 2>&1 end end end
Reload the shell profile (i.e.
~/.config/fish/config.fish
) to apply the changes:source ~/.config/fish/config.fish
This will start the default Podman machine if it is not already running.