Podman - a daemon-less docker alternative
Posted in development on November 13, 2020 by Adrian Wyssmann ‐ 6 min read
Podman is a daemonless container engine for developing, managing, and running OCI Containers on your Linux System. Containers can either be run as root or in rootless mode.
We have seen what is Docker and we also have seen that docker requires a daemon to be running
So the docker daemon is a central point of failure, cause if the docker daemon fails to run, your containers will as well. So here comes Podman
What is Podman
Podman is a daemonless container engine for developing, managing, and running OCI Containers on your Linux System. Containers can either be run as root or in rootless mode.
It offers basically the same as docker plus some things more
- Support multiple image formats including the OCI and Docker image formats.
- Support for multiple means to securely download images including trust & image verification.
- Container image management (managing image layers, overlay filesystems, etc).
- Full management of container lifecycle.
- Support for pods to manage groups of containers together.
- Resource isolation of containers and pods.
They use the same command set as docker cli so you can simply create an alias alias docker=podman
. Installation is simple as it is available for the most linux distribution, Mac OS and also Windows. However, the downside for Windows is that
You can do this from a Windows desktop as long as you have access to a linux box either running inside of a VM on the host, or available via the network
Yeah in a corporate environment this might not be the case - I cannot install any virtual machine engine on my work computer nor do I have the latest Windows so I could potentially use [WSL]({{ ref “windows-subsystem-for-linux-wsl”>}}).
Let’s get started with rootless containers
On my Arch, I quickly install podman and then run a simple podman search multitool
:
I am quite surprised - not only that it works - but that it does not only search docker.io but also quay.io, RedHat’s container registry. So let’s run a container:
Bummer. Well checking the installation instructions which redirects me here, which does really help. So I digged deeper and found Basic Setup and Use of Podman in a Rootless environment. plus the following articles in Archlinux - Wiki:
- https://wiki.archlinux.org/index.php/Podman
- https://wiki.archlinux.org/index.php/cgroups#Switching_to_cgroups_v2
- https://wiki.archlinux.org/index.php/Kernel_parameters
In addition you may also read How does rootless Podman work? to understand why certain things are needed.
Apparently there are some things required in order for rootless containers to work, so let’s do it:
Ensure you enable
kernel.unprivileged_userns_clone=1
. For me it’s already enabledIf it’s not you can enable it by running
sudo sysctl kernel.unprivileged_userns_clone=1
or permanently by adding it to/etc/sysctl.d/userns.conf
Enable cgroups v2 - which is enabled in Arch but default systemd mounts cgroup v1. I enabled it manually as follows for now:
Download
crun
as The default runtimerunc
does not currently work with cgroup V2 enabled systems, so you have to switch to the alternative OCI runtimecrun
Rootless Podman requires the user running it to have a range of UIDs listed in
/etc/subuid
and/etc/subgid
files. As these do not exist, I have to create themAs you recently created the empty files, you also have to create ids for
subuids
andsubuids
to be used:At least we run the migrate command as Github Issue #3421
So let’s see again…
Yeah, seems container started successfully, let’s check with podman ps
Let’s also see if network connectivity works from the pod outside:
So running single containers is - as soon as your machine’s requirements are set - quite straightforward, especially when you already know docker
commands.
Plugins
One nice thing is that docker has a plugin api which seems not be the case for Podman.
docker-compose with podman
So far this looks promising as a valid alternative of docker
but what about the functionality which docker-compose
brings to you
Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration.
Uninstalling docker from your system obviously also removes docker-compose
. There seems to be a project “podman-compose” in github which tries to tackle this. However, as of today, This project is still under development.
I will give it a change and will create a separate post concerning this.