How To Install Podman on Debian 12
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 12 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
Prerequisites
- A Debian 12 VPS
- SSH root access or a non-root user with sudo privileges
Step 1. Log in via SSH
Let’s log in to our Debian 12 VPS with SSH as a root user or as a regular user with sudo privileges.
If you cannot log in as root, remember to replace “root” with a user that has sudo privileges. Additionally, replace the “IP_Address” and “Port_Number” with your server’s respective IP address and SSH port.
Step 2. Install Podman on Debian 12
Update your package index files on the system with this command:
# apt update
You can now install Podman using the apt command:
# apt install podman podman-compose
To check if Podman has been successfully installed, you can run:
# podman version
After which you should receive a similar output to this:
Step 3. Podman container registries
If there is no repository to fetch and install container Images by Podman, then we need to add that manually. We can use popular repositories such as Docker.io, Redhat, and Fedora.
Modify the Registry configuration file by executing the following command:
nano /etc/containers/registries.conf
If you want to add the following registries, Please navigate to the bottom of the document and insert the provided line.
[registries.search] registries = ['quay.io', 'docker.io']
Once you’ve finished, save the file by pressing Ctrl+X, followed by the Y key, and exit by pressing Enter.
You can employ Podman for creating and managing containers, along with other features. However, we won’t enumerate all of its capabilities in this context.
Step 4. Using Podman
Just like Docker, you can use almost the same commands to pull or run containers. To pull the alpine image for example, you can run:
# podman pull docker.io/alpine
You can also simply run podman pull alpine
and select from which container registry to pull the image.
Running an Nginx container with port mapping can be done with this command:
# podman run -dit --name nginx -p 8080:80 docker.io/nginx
This will run an Nginx container in the background, mapping port 80 from the container to port 8080 on our server.
You can also check the containers that are currently running, or all containers that were also previously running with the commands:
# podman ps
# podman ps -a
You can also create pods, for example. To create an empty pod, you can run this:
# podman pod create --name web
Now that the pod is created, we can add a container to it:
# podman run -dt --pod web alpine:latest top
To check the containers running inside a pod, you can now run:
# podman ps --pod
Congratulations! You have successfully installed Podman on Debian 12 as well as practiced some of the basic management commands for Podman.