Install and Use Podman on Debian 12 Bookworm

In this tutorial, you will learn to Install and Use Podman on Debian 12 Bookworm. You can install Podman from the APT repository. Podman is an open-source container management tool for Linux-based distros that can be used for:

  • developing
  • managing
  • and running OCI containers.

How To Install and Use Podman on Debian 12 Bookworm?

To set up Podman, you must have access to your server as a non-root user with sudo privileges. For this purpose, you can check this guide on Initial Server Setup with Debian 12 Bookworm.

Now proceed to the following steps to complete this guide.

Step 1 – Install Podman with APT on Debian 12

First, you must run the system update by using the command below:

sudo apt update

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

sudo apt install podman -y

Then, verify your installation by checking its version:

podman --version
Output
podman version 4.3.1

Step 2 – How To Start Podman on Debian Linux?

At this point, you can 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 12:

sudo systemctl status podman.socket
Output
● podman.socket - Podman API Socket
     Loaded: loaded (/lib/systemd/system/podman.socket; enabled; preset: enable>
     Active: active (listening) since Tue 2023-07-18 04:40:41 EDT; 55s ago
   Triggers: ● podman.service
       Docs: man:podman-system-service(1)
     Listen: /run/podman/podman.sock (Stream)
     CGroup: /system.slice/podman.socket
...

To get complete information about Podman, you can use the command below:

podman info
Output
host:
  arch: amd64
  buildahVersion: 1.28.2
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - hugetlb
  - pids
 ...
  cpus: 2
  distribution:
    codename: bookworm
 distribution: debian
    version: "12"
...

Step 3 – How To Configure Podman Registries on Debian Linux?

Podman has a great feature allows you to search and pull images from any registry. You can edit the registry file and define the list of container registries. To do this, you can open the file with the following command:

sudo vi /etc/containers/registries.conf

Add the following content to the file:

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

When you are done, save and close the file.

With this option, when you run the podman search or podman pull command, Podman will contact these registries beginning with the first one in that order.

Restart the Podman service to apply the changes on Debian 12:

sudo systemctl restart podman.socket

Step 4 – How To Use Podman on Debian 12 Bookworm?

If you have Podman installed and configured on your server, you can start using it. We will show you to search and pull images with Podman and create a container.

Search Images with Podman

Now just like Docker, you can use the Podman search command to search an image. For example, search for the Debian image by using the command below:

podman search debian
Output
NAME                                           DESCRIPTION
docker.io/library/ubuntu                       Ubuntu is a Debian-based Linux operating sys...
docker.io/library/debian                       Debian is a Linux distribution that's compos...
docker.io/library/neurodebian                  NeuroDebian provides neuroscience research s...
docker.io/bitnami/debian-base-buildpack        Debian base compilation image
...

Download or Pull Images with Podman

At this point, you can easily pull your searched image by using the command below:

podman pull debian
Output
Resolved "debian" as an alias (/etc/containers/registries.conf.d/shortnames.conf)
Trying to pull docker.io/library/debian:latest...
Getting image source signatures
Copying blob d52e4f012db1 done
Copying config 3676c78a12 done
Writing manifest to image destination
Storing signatures
3676c78a12ad77e170916695d2f192797ddd3eb653d7a1b1ad4c20ab5471891a

List All Downloaded Images with Podman

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

podman images

In my case:

Output
REPOSITORY                TAG         IMAGE ID      CREATED      SIZE
docker.io/library/debian  latest      3676c78a12ad  2 weeks ago  121 MB
docker.io/library/ubuntu  latest      5a81c4b8502e  2 weeks ago  80.3 MB

Create a Container with Downloaded Images with Podman

Once you have the image of the application 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 make a container using a 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:

deb@305535c6f095:/#

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 have learned to Install Podman with APT on Debian 12 Bookworm Configure the Podman registries and Use it to search and pull images and create a container with it.

Hope you enjoy it. You may be interested in these articles too:

Install and Use Iptables on Debian Linux

Install and Secure SSH Server on Debian 12 Bookworm

How To Install Samba File Sharing on Debian 12

Install LibreOffice with Deb File on Debian Linux

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Stay informed and not overwhelmed, subscribe now!