Docker has been the go-to tool for managing containers. To counter that, Red Hat announced Podman, a fully open source alternative to Docker.
In this article, I will demonstrate how you can install Podman properly on Ubuntu.
Properly? What does it mean?
Podman requires a few complementary tools like Buildah and Skopeo to function thoroughly. I cover them all in this guide.
What is Podman?
Simply put, Podman is an offering from Red Hat, intended to be a replacement for Docker. But is it? Well, yes and no.
From what I (emphasis on the "I") have seen, Docker is used for managing containers. Yes, it has other uses, but this is one of the most prominent ones out there.
If that is your use case, managing containers, Podman really is a real replacement for Docker.
But that is not all that Docker offers. Docker has three main and quite distinct functionalities. They are as follows:
- Create, manage, and destroy containers.
- Build your custom images
- Publish your custom images to container registries like Docker Hub and Quay.io
If you have used Docker for a moderately long time, you will know that all three functionalities are already built into Docker.
On the other hand, Podman can only create, manage and destroy containers.
What if you want to create your own images and/or publish them to a registry? Do you have to use Docker for that? No. Red Hat offers tools like Buildah and Skopeo complementing their offering of Podman as a complete Docker replacement.
Instead of using Docker to build images, Red Hat is offering Buildah to build your own OCI compatible images. And, instead of using Docker to publish your custom images to registries like Docker Hub and Quay.io, you are given the Skopeo tool.
- Podman: Create, manage, and destroy containers
- Buildah: Build your custom images
- Skopeo: Publish your custom images to container registries like Docker Hub and Quay.io
Depending on your needs, you may install one or more of the tools I mentioned. With that cleared, let us now see how to install them on Ubuntu.
Installing Container Tools
The category under which Podman, Buildah and Skopeo fall is usually referred to as Container Tools.
Podman is available in the Ubuntu repositories and can be installed using the following command:
sudo apt install podman
Once Podman is installed, you can verify it by running the
podman -v command. Below is the output from my system:
$ podman -v podman version 3.4.4
By default, Podman does not have any remote registries configured. This will create some headaches when you try to pull an image using the
podman pull command.
To configure Docker Hub as a registry, execute the following command:
sudo sed -i "s/# unqualified-search-registries.*/unqualified-search-registries\ =\ [\"docker.io\"]/" /etc/containers/registries.conf
Install podman-docker to replace docker [optional]
Optionally, if you want
podman to be executed even when you run the
docker command, you can install the
podman-docker package. You can do so with the following command:
sudo apt install podman-docker
podman-docker is installed, you can verify it by running the
docker -v command. It won't just symlink to the
docker binary. Below is the output of running it on my computer:
$ docker -v Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. podman version 3.4.4
Usually, when you install Podman, Buildah is automatically installed as a dependency for Podman. But if you have a dedicated machine just to build images, you may want to install Buildah only.
In that case, use the following command to install Buildah:
sudo apt install buildah
Once that is done, you can verify if Buildah is correctly installed or not. That can be done using the following command:
buildah -v command on my computer gives me the following output:
$ buildah -v buildah version 1.23.1 (image-spec 1.0.1, runtime-spec 1.0.2-dev)
One more thing you may install on a build-only machine is Skopeo. As discussed earlier, Skopeo allows you to publish your custom images to registries like Docker Hub and/or Quay.io
To install Skopeo, execute the following command in your terminal:
sudo apt install skopeo
Once Skopeo is installed, you can verify it using the
skopeo -v command. Below is how the output appears on my comptuer:
$ skopeo -v skopeo version 1.4.1
Bonus: Installing podman-compose
If you have managed more than 4 to 8 containers, you quickly realized that modifying the
docker run command can be very tedious. An alternative to that is using a
As of Ubuntu 22.04,
podman-compose is not available in the first-party repositories. But fret not! It is still easy to install.
podman-compose, run the following command in your terminal:
pip3 install podman-compose
Doing so should install
podman-compose using Python Pip package management tool. You can verify this by running the
podman-compose -v command.
Below is the output from my computer:
$ podman-compose -v ['podman', '--version', ''] using podman version: 3.4.4 podman-composer version 1.0.3 podman --version podman version 3.4.4 exit code: 0
This article covers how you can install Docker alternatives provided by Red Hat. These alternatives include Buildah, for building images, Podman, for managing containers (compatible with Docker's command line interface) and Skopeo, to publish your custom images to registries.