
Podman also known as Pod Manager is an open-source, daemonless container engine used to build, manage, and run Open Container Initiative (OCI) containers. Podman does not require a background daemon process making it suitable for environments such as production environments and CI/CD pipelines with improved resource usage.
This article explains how to install Podman on Debian 12 to build and run containerized applications on the server.
Before you begin:
Podman is available in the default package repositories on Debian 12. Follow the steps below to install the latest Podman package using the APT package manager.
Update the server's package index.
Install Podman.
View the installed Podman version on your server.
Output:
Podmans uses two linked service profiles to run on a server, podman.service and podman.socket. podman.service enables access to Podman CLI and interaction with the Podman engine to run container management commands. podman.socket enables remote access to the application API, and integrates Podman with other container development tools. Follow the steps below to manage the Podman system service and enable the application to run on your server.
Enable the Podman system service to automatically start at boot.
Start the Podman service.
View the podman.socket service status and verify that it's running.
Output:
View the podman.service status and verify that it's triggered by the podman.socket service.
Output:
Stop the Podman service.
Restart the Podman service.
Podman supports multiple image sources and registries to pull and run container images on your server. The /etc/containers/registries.conf configuration file includes registry information used by Podman to find container images. Podman uses default registries such as Docker Hub, quay.io, and registry.fedoraproject.org if the configuration file does not include any registry sources. Follow the steps below to deploy a containerized HTTP application using Podman using the default registry sources.
Pull the latest Apache HTTP server container image from Docker Hub using Podman CLI.
Your output should be similar to the one below when successful.
List all Podman images and verify that the new container is available on your server.
Output:
Deploy a new containerized application using the httpd image and expose it on the localhost port 8080.
List all active Podman container processes and verify that your application is active.
Your output should be similar to the one below.
Access the containerized application using your host port 8080 and verify that it's running.
Output:
Stop the container.
Podman supports private and public registries such as the Vultr Container Registry to manage container images. Follow the steps below to create a new Python Flask application, build a container image, and store it in the Vultr Container Registry.
Access your Vultr Container Registry's management page.
Find your registry details within the overview tab, and copy the username and API key credentials to your clipboard.
Create a new environment variable to store your Vultr Container Registry URL. For example, https://ewr.vultrcr.com/demo.
Create another environment variable to store your Vultr container registry username. Replace example-user with your actual username.
Create an environment variable to store your Vultr Container Registry API key. Replace registry-key with your actual API key.
Login to the Vultr Container Registry using Podman CLI and the environment variable values.
Your output should be similar to the one below when successful.
Create a new sample Python application file app.py.
Add the following contents to the file.
Save and close the file.
The above Python application initializes a new Flask web server that displays a Greetings from Vultr prompt when accessed using the application port 5000.
Create a new Dockerfile to containerize the Python application.
Add the following contents to the file:
Save and close the file.
The above Dockerfile configuration builds a new Python Flask application container image with Python 3.9, installs Flask, and runs the application on port 5000.
Build the new container image with all files in your working directory.
Your output should be similar to the one below when successful.
View all container images on your server and verify that the new application image is available.
Output:
Tag the httpd container image with your desired Vultr Container Registry repository name.
List all Podman images again and verify that the tagged image is available.
Output:
Push the tagged image to your Vultr Container Registry.
Output:
Access your Vultr Container Registry's management page, navigate to the Repositories tab, and verify that the new container image repository is available.
Deploy a new application using the container image from your Vultr Container Registry and forward the container port 5000 to your localhost port 5000.
Access the localhost port 5000 using curl to verify that your containerized application is running correctly.
Output:
You have installed Podman on your Debian 12 server and managed the containerized application processes. Podman uses container processes similar to Docker and allows you to pull, run, and manage containers on your server. You can integrate Podman with other container development tools using the application API or use custom registries such as the Vultr Container Registry to store your container images. For more information, visit the official Podman documentation.
0 Comments
Be the first to comment and share your perspective with the community.