Podman ?

Podman is a daemonless container engine for developing, managing, and running Open Container Initiative (OCI) containers and container images on your Linux System.

Podman provides a Docker-compatible command line front end that can simply alias the Docker cli, alias docker=podman. You can know more on their website.

If you want to use podman / podman-compose in place of docker / docker-compose on Debian, you are reading the right how-to :-)

Remove docker

If you already have docker installed, you can remove it with these commands:

sudo apt remove --purge $(dpkg -l | grep -E "(docker|containerd)" | awk '{print $2}')
sudo apt autoremove --purge

Setup podman / podman-compose

Configure libcontainers repository

We will configure first the libcontainers repository who contains the latest stable version of podman.

Retrieve the repository GPG signing key and put it on /usr/share/keyrings/libcontainers.gpg:

curl -s https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_11/Release.key | gpg --dearmor | sudo tee /usr/share/keyrings/libcontainers.gpg > /dev/null

Configure the repository in the new DEB822 format on /etc/apt/sources.list.d/libcontainers.sources:

cat << EOF | sudo tee /etc/apt/sources.list.d/libcontainers.sources > /dev/null
Types: deb
URIs: https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_11/
Suites: /
Signed-By: /usr/share/keyrings/libcontainers.gpg

Install podman

Refresh your apt sources then install podman in rootless mode and all needed dependencies:

sudo apt install podman-rootless podman-plugins podman-machine-cni uidmap containernetworking-plugins python3-dotenv slirp4netns

You can now validate it is working by launching the hello-world container:

podman run -rm hello-world

Setup podman-compose

podman-compose is a python script you can retrieve like this:

sudo curl -so /usr/local/bin/podman-compose https://raw.githubusercontent.com/containers/podman-compose/devel/podman_compose.py
sudo chmod +x /usr/local/bin/podman-compose

That’s it, you can now launch your docker-compose files with podman-compose \0/

Additional configuration for systemd

You must set the cgroup_manager to cgroupfs if you are running systemd:

cat << EOF | sudo tee /etc/containers/containers.conf > /dev/null
cgroup_manager = "cgroupfs"
events_logger = "file"

Use privileged ports

If you launch a nginx container and try to expose the 80 port, you will have a warning that you can’t use port < 1024.

To be able to use privileged ports as unprivileged user, you can set this sysctl rule:

# Set the rule
sudo cat << EOF | sudo tee /etc/sysctl.d/99-podman-rootless.conf
# Enable it
sudo sysctl --system