Install and Use Podman on Debian 11

This guide intends to teach you How To Install and Use Podman on Debian 11.

What is podman?

Podman is an open-source container management tool for developing, managing, and running OCI containers. Let’s take a look at some of the advantages of Podman, in comparison with other container management tools:

  • Images created by Podman are compatible with other container management tools. The images created by Podman adhere to OCI standards, and hence they can be pushed to other container registries like Docker Hub
  • It can be run as a normal user without requiring root privileges. When running as a non-root user, Podman creates a user namespace inside which it acquires the root permission. This allows it to mount file systems and setup required containers
  • It provides the ability to manage pods. Unlike the other container runtime tools, Podman lets the user manage pods (a group of one or more containers that operate together). Users can perform operations like create, list, and inspect the pods

However, there are certain limitations to Podman:

  • It only runs on Linux-based systems. Currently, Podman only runs on Linux-based operating systems and doesn’t have a wrapper for Windows and macOS.
  • There is no alternative for Docker Compose. Podman doesn’t have support for managing multiple containers locally, similar to what Docker Compose does. An implementation of Docker Compose using the Podman backend is being developed as part of the podman-compose project, but this is still a work in progress.

How To Install and Use Podman on Debian 11

To install Podman, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide the Initial Server Setup with Debian 11.

Now Follow the steps below to complete this guide.

Installing Podman on Debian 11

Podman packages are available in the default Debian 11 repository. So use the following command to install Podman on your server:

sudo apt install podman

Then, verify your installation by checking its version:

podman --version
Output
podman version 3.0.1

Start and enable your Podman service by using the following commands:

# sudo systemctl start podman.socket
# sudo systemctl enable podman.socket

Check your podman service is active and running on Debian 11:

sudo systemctl status podman.socket
Output
● podman.socket - Podman API Socket
     Loaded: loaded (/lib/systemd/system/podman.socket; enabled; vendor preset:>
     Active: active (listening) since Thu 2022-09-08 03:24:21 EDT; 2min 0s ago
   Triggers: ● podman.service
       Docs: man:podman-system-service(1)
     Listen: /run/podman/podman.sock (Stream)
     CGroup: /system.slice/podman.socket

To get full information about Podman, you can use:

podman info
Output 
host:
  arch: amd64
  buildahVersion: 1.19.6
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: 'conmon: /usr/bin/conmon'
    path: /usr/bin/conmon
    version: 'conmon version 2.0.25, commit: unknown'
  cpus: 2
  distribution:
    distribution: debian
    version: "11"
...

Configure Podman registries on Debian 11

The registry file registry.conf is a configuration file that specifies the container registries to be used whenever you want to push or pull an image. The full path to the file is /etc/containers/registries.conf. There are various container registries out there including Docker hub, Quay.io, RedHat, and many more.

You can view the file using your text editor, here we use vi:

sudo vi /etc/containers/registries.conf

In Docker, the only container registry is Docker Hub. Podman offers users more freedom to search and pull images from any registry. You can define the list of container registries by adding the following line:

unqualified-search-registries = [ 'registry.access.redhat.com', 'registry.redhat.io', 'docker.io']

When you are done, save and close the file.

Once running the podman search or podman pull command, podman will contact these registries beginning with the first one in that order. Save the changes and exit the file.

How To Use Podman on Debian 11

Now that you have installed Podman on your server let’s see its basic usage.

Search and pull images with Podman

Just like Docker, you can use the Podman command line to search Images but from different repositories.

For example, if you want to install a Debian container using Podman, then you can search what are the images available through the different repositories.

podman search debian

Then, you can download and pull images with the following command:

podman pull debian

List all Images with Podman

If you have downloaded multiple images and now want to see what are the available images on your system, you can list all of them using the following command:

podman images

In my case:

Output
REPOSITORY                TAG     IMAGE ID      CREATED      SIZE
docker.io/library/debian  latest  dd8bae8d259f  2 weeks ago  129 MB

Create a Container with Podman

Once you have the image of the application that you want, you can create a container with it. Here we have downloaded the Debian image with Podman. Now we will show how to use it to create a container using Debian image.

To do this, you can use the following command:

podman run -dit --name orca debian

Note–name is a parameter to give the container whatever friendly name you want to assign.

To access your Container command line, use the following command:

podman attach orca

You will see that your command prompt changes to your container ID:

sam@1b11e1035173:/#

To start your container, you can use the command below:

podman start container-id or name

To stop your container, you can use the following command:

podman stop container-id or name

For more information, you can visit the Podman Documentation page.

Conclusion

At this point, you learn to Install and Use Podman on Debian 11.

Hope you enjoy it.

You may be intrested in these articles:

How To Set up Network bridge on Debian 11

How To Install Python 3.10 on Debian 11

Set up WireGuard VPN Server on Debian 11

Install and Configure LibreNMS on Debian 11

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Your email address will not be published. Required fields are marked *

Stay informed and not overwhelmed, subscribe now!