How To Install Podman on Debian 11/10/9

Posted on 251 views

Podman is a daemonless container engine for developing, managing, and running OCI Containers on your Linux System. It was created to replace Docker which requires a daemon running in the background. This guide will walk you through the installation of Podman on Debian 11/10/9 Linux machines.

Podman uses container runtimes as well for example runc but the launched containers are direct descendants of the podman process. It is part of the libpod library

Step 1: Update System

Update package index:

sudo apt -y update && sudo apt -y upgrade

After the upgrade we always recommend a system reboot if this is a requirement.

[ -f /var/run/reboot-required ] && sudo reboot -f

Step 2: Install pre-requisites

In this guide, we will use ansible role which automates the installation of Podman on Debian system. If ansible is already installed on the system please remove it.

sudo apt update
sudo apt remove ansible

Install other tools required for the installation to work.

sudo apt install vim git uidmap fuse3 fuse-overlayfs

If planning to build from source in future you can install all dev tools

sudo apt install \
  btrfs-progs \
  git \
  golang-go \
  go-md2man \
  iptables \
  libassuan-dev \
  libbtrfs-dev \
  libc6-dev \
  libdevmapper-dev \
  libglib2.0-dev \
  libgpgme-dev \
  libgpg-error-dev \
  libprotobuf-dev \
  libprotobuf-c-dev \
  libseccomp-dev \
  libselinux1-dev \
  libsystemd-dev \
  pkg-config \
  runc \

Install Python and pip tools on your Debian system

### Python 3 ###
sudo apt install python3 python3-pip
sudo  pip3 install --upgrade pip

### Python 2 ###
sudo apt install python2 python2-pip
sudo  pip install --upgrade pip

Step 3: Install Podman on Debian 11/10/9

We can install Ansible from APT repository or using ansible depending on your preference.

Method 1: InstallPodman on Debian from APT repos

There are two main APT repositories containing Podman Deb packages.

Option 1) Using Kubic libcontainers repository

Import repository GPG key:

sudo apt update && sudo apt install wget lsb-release -y
source  /etc/os-release
cat Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/libcontainers.gpg  >/dev/null

Add Kubic libcontainers repository to your Debian system.

echo "deb$VERSION_ID/ /" | sudo tee /etc/apt/sources.list.d/libcontainers.list

Check if the repository added is visible in the list.

$ sudo apt update
Hit:1 bullseye InRelease
Hit:2 bullseye-updates InRelease
Hit:3 bullseye-security InRelease
Hit:4 bullseye-backports InRelease
Get:5  InRelease [1634 B]
Get:6  Packages [34.4 kB]
Fetched 36.0 kB in 1s (62.6 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done

Perform system upgrade:

sudo apt update && sudo apt -y full-upgrade
[ -f /var/run/reboot-required ] && sudo reboot -f

Then final step is the installation of Podman on Debian 11/10/9:

sudo apt install podman

Check version installed to confirm this was successful.

$ podman version
Version:      3.4.2
API Version:  3.4.2
Go Version:   go1.15.15
Built:        Wed Dec 31 19:00:00 1969
OS/Arch:      linux/amd64

Option 2) Using alvistack APT repository

An alternative Debian package installation option is from alvistack package repos. Start with repository key importation process.

source  /etc/os-release
wget$VERSION_ID/Release.key -O alvistack_key
cat alvistack_key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/alvistack.gpg  >/dev/null

Add the repo to your system.

echo "deb$VERSION_ID/ /" | sudo tee  /etc/apt/sources.list.d/alvistack.list

You should be able to see the repository in the list when you run apt update command:

$ sudo apt update
Hit:1 bullseye-security InRelease
Hit:2 bullseye InRelease
Hit:3 bullseye-updates InRelease
Get:4  InRelease [1538 B]
Hit:5 bullseye-backports InRelease
Get:7  Packages [197 kB]
Fetched 200 kB in 1s (342 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done

Install Podman on Debian system using apt package manager

sudo apt install podman python3-podman-compose 

We can see the version of Podman installed by running the commands below:

$ podman version
Client:       Podman Engine
Version:      4.1.1
API Version:  4.1.1
Go Version:   go1.18.3
Built:        Wed Dec 31 19:00:00 1969
OS/Arch:      linux/amd64

Method 2: Install Podman on Debian using Ansible

For Ansible automated way, start by cloning  Ansible Role from Github using git command:

mkdir -p ~/.ansible/roles
cd ~/.ansible/roles
git clone podman

Use pip3/pip to install all requirements including ansible.

cd podman
pip3 install --upgrade --ignore-installed --requirement requirements.txt

Add ~/.local/bin to your PATH env

### Bash ###
echo 'export PATH=$PATH:~/.local/bin' >>~/.bashrc
source ~/.bashrc
echo $PATH

### Zsh ###
echo 'export PATH=$PATH:~/.local/bin' >>~/.zshrc
source ~/.zshrc
echo $PATH

Now execute the sequence necessary to converge the instances

molecule converge

Sample execution output:

ASK [include role] ************************************************************

TASK [podman : include default variables] **************************************
ok: [localhost]

TASK [podman : include release specific variables] *****************************
ok: [localhost] => (item=/home/debian/.ansible/roles/podman/files/../vars/debian-11.yml)

TASK [podman : include release specific tasks] *********************************
included: /home/debian/.ansible/roles/podman/tasks/debian.yml for localhost => (item=/home/debian/.ansible/roles/podman/tasks/./debian.yml)

TASK [podman : apt-key add] ****************************************************
ok: [localhost] => (item='keyring': '/etc/apt/trusted.gpg.d/home_alvistack.gpg', 'url': '', 'id': '789CFFDE0295B8A1F4E5690C4BECC97550D0B1FD', 'state': 'present')

TASK [podman : apt-add-repository] *********************************************
ok: [localhost] => (item='filename': 'home:alvistack', 'repo': 'deb /', 'state': 'present')

TASK [podman : apt-get install] ************************************************
changed: [localhost] => (item='state': 'latest', 'name': 'podman')

TASK [podman : flush handlers] *************************************************

RUNNING HANDLER [podman : podman | systemctl restart podman.service] ***********
ok: [localhost -> localhost] => (item=localhost)

TASK [podman : systemctl start podman.service] *********************************
ok: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=45   changed=10   unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Once done finalize the installation by running the following command:

molecule verify

Execution output is as shared in screenshot below


Step 4: Confirm Podman installation on Debian 11/10/9

Check podman version

$ podman --version
podman version 4.1.1

$ podman version
Client:       Podman Engine
Version:      4.1.1
API Version:  4.1.1
Go Version:   go1.18.3
Built:        Wed Dec 31 19:00:00 1969
OS/Arch:      linux/amd64

You can display information pertaining to the host, current storage stats, and build of podman.

$ podman info
  arch: amd64
  buildahVersion: 1.26.1
  - memory
  - pids
  cgroupManager: cgroupfs
  cgroupVersion: v2
    package: conmon_100:2.1.0-2_amd64
    path: /usr/libexec/podman/conmon
    version: 'conmon version 2.1.0, commit: '
    idlePercent: 99.33
    systemPercent: 0.23
    userPercent: 0.45
  cpus: 4
    codename: bullseye
    distribution: debian
    version: "11"
  eventLogger: file
  hostname: debian

Main configuration files:

  • /etc/containers/registries.conf – configuration file which specifies which container registries should be consulted when completing image names which do not include a registry or domain portion.
  • /etc/containers/mounts.conf – specify volume mount directories that are automatically mounted inside containers when executing the podman run or podman build commands

Step 5: Test Podman installation on Debian 11/10/9

Lt’s start by pulling Alpine docker image.

$ podman pull alpine
Trying to pull
Getting image source signatures
Copying blob 050382585609 done
Copying config b7b28af77f done
Writing manifest to image destination
Storing signatures

Run docker container:

$ podman images
REPOSITORY                 TAG      IMAGE ID       CREATED       SIZE  latest      e66264b98777  3 weeks ago  5.82 MB

$ podman run -ti /bin/sh
/ # cat /etc/os-release 
NAME="Alpine Linux"
PRETTY_NAME="Alpine Linux v3.16"
/# exit

Now that we have confirmed we can create a container, let’s remove it.

$ podman rm -f `podman ps -aq`

There you go. Check more examples on Podman tutorial available in Github and our guide.


Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.