In this tutorial, we will show you how to install Podman on Debian 12. For those of you who didn’t know, Podman is a container management tool that allows you to run, manage, and deploy containers effortlessly. Unlike Docker, Podman does not require a separate daemon, making it more lightweight and secure. Some key features of Podman include:
- Rootless containers: Run containers as a non-root user, enhancing security and isolation.
- Pod support: Manage groups of containers collectively using the Podman pod concept.
- Container image management: Pull, build, and manage container images efficiently.
- Network and volume management: Configure network and volume settings for containers.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you step-by-step install Podman on a Debian 12 (Bookworm).
- A server running one of the following operating systems: Debian 12 (Bookworm).
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Podman.
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install Podman on Debian 12 Bookworm
Step 1. Before we install any software, it’s important to make sure your system is up to date by running the following
apt commands in the terminal:
sudo apt update sudo apt install curl gpg gnupg2 software-properties-common apt-transport-https lsb-release ca-certificates
This command will refresh the repository, allowing you to install the latest versions of software packages.
Step 2. Installing Podman on Debian 12.
Now that we have prepared the environment, let’s proceed with the installation of Podman on Debian 12 Bookworm. Now we enable the Podman repository by adding the GPG key and repository URL with the following command:
sudo sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_12/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" sudo sh -c "wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Debian_12/Release.key -O- | sudo apt-key add -"
Update the package lists and install Podman by executing the following command:
sudo apt update sudo apt install podman
Step 3. Configuring Podman.
Now that Podman is installed, we need to perform some initial configurations.
- Enable rootless Podman (optional):
By default, Podman runs as a non-root user for enhanced security. If you prefer to use rootless Podman, execute the following command:
podman system migrate
- Set up Podman storage: Configure the storage location for Podman’s images and containers. By default,
Podman uses the
/var/lib/containers directory. To change the storage location, create the
registries.conf file in the
/etc/containers directory and specify the desired storage path. For example:
sudo mkdir -p /etc/containers echo -e "[registries.search]\nregistries = ['docker.io']\n[registries.insecure]\nregistries = \n[registries.block]\nregistries = " | sudo tee /etc/containers/registries.conf
- Create a sample container:
Let’s create a basic NGINX container to verify the successful installation of Podman. Execute the following commands:
podman pull nginx:latest podman run -d --name my-container -p 8080:80 nginx:latest
Step 4. Exploring Advanced Podman Features (Optional).
Podman offers various advanced features for managing and customizing your containers. Here are some key features you may find useful:
Using Podman with root privileges: While Podman encourages running containers as a non-root user, there may be situations where running as root is necessary. Use the
sudocommand before executing Podman commands to run them as root.
Managing networks and volumes: Create and manage custom networks and volumes for your containers using Podman’s network and volume management capabilities. Explore the
podman volumecommands for more details.
Creating and managing Podman pods: Podman pods allow you to group and manage multiple containers as a single unit. Learn how to create and manage pods using the
Working with Podman images and containers: Discover additional Podman commands such as
podman ps, and
podman rmto manage container images and running containers effectively.
Monitoring Podman containers: Monitor resource usage, logs, and statistics of your containers using Podman commands like
Configuring Podman security: Enhance container security by configuring Podman with features like seccomp profiles, user namespaces, and more. Refer to the official Podman documentation for detailed instructions.
Step 5. Troubleshooting Common Issues.
Encountering issues during Podman installation or usage is not uncommon. Here are a few common issues you may face along with their potential solutions:
Unable to install Podman: If you encounter issues while installing Podman, ensure that the Podman repository is added correctly. Double-check the repository URL and GPG key, and try the installation process again.
Container run failures: If running containers with Podman fails, verify that you have specified the correct image name and ensure that the required ports are not in use by other services.
Firewall configuration issues: If you face connectivity or networking issues with containers, ensure that the necessary ports are open in the firewall. Use the
firewall-cmdcommand to manage firewall rules.
Congratulations! You have successfully installed Podman. Thanks for using this tutorial to install Podman on Debian 12 Bookworm. For additional help or useful information, we recommend you check the official Podman website.