
Podman is an open-source container management tool that enables you to develop, manage, and run OCI containers without a background daemon process. Its daemonless design enhances security and reduces resource usage.
This article explains installing Podman on Ubuntu 22.04 and performing essential container operations to manage containerized applications.
Before you begin:
Have an Ubuntu 22.04 server.
Create a Container Registry to store your Podman container images. This article uses Vultr Container Registry as an example, but the commands can be adapted to any registry by switching to the appropriate registry-specific variables.
Access the server using SSH as a non-root user with sudo privileges.
Podman is available in the default Ubuntu 22.04 package repositories. Follow the steps below to install Podman using the APT package manager:
Update the server's package index.
Install Podman.
View the installed Podman version on your server.
Your output should be similar to the one below.
Podman uses two system services: podman for managing containers through the CLI, and podman.socket for remote API access via systemd. podman.socket enables remote management and integration with development tools. Follow the steps below to manage and enable Podman services on your server.
Enable the service to automatically start at system boot.
Start the service.
Stop the service.
Restart the service.
View the service status and verify that it's running.
Output:
Podman uses image sources defined in the /etc/containers/registries.conf file to pull container images. Follow the steps below to deploy an HTTP server using the Nginx container image from Docker Hub.
Pull the Nginx container image from Docker Hub.
Output:
List all container images available on the server.
Verify that the Nginx container image is available in your output.
Run a new containerized application using the Nginx image.
List all running Podman container processes.
Output:
Test access to the container using the host port 9090.
Output:
Podman supports custom registries like the Vultr Container Registry for building and storing container images. Follow the steps below to create a Python FastAPI application, build a container image, and push it to your Vultr Container Registry.
Access your Vultr Container Registry's management panel to view the registry's username and API key credentials.
Create a new environment variable to store your Vultr Container Registry name.
Create another environment variable to store the registry username.
Create a environment variable to store the registry's API key.
Log in to your Vultr Container Registry using the environment variable values.
Replace sjc.vultrcr.com with the URL of the region where your VCR is hosted.
Output:
Create a new Python application file app.py.
Add the following contents to the file.
Save and close the file.
The above FastAPI application initializes a new web server on port 5000 that displays a Hello from Vultr message when accessed.
Create a new Dockerfile configuration.
Add the following contents to the file.
Save and close the file.
The above Dockerfile sets up a Python 3.12 environment, installs fastapi and uvicorn, and starts a web server on port 5000 using the Python application file app.py.
Build the container image with all files in your working directory.
Output:
Tag the container image with your Vultr Container Registry's name.
Replace sjc.vultrcr.com with the URL of the region where your VCR is hosted.
List all container images on your server and verify that the tagged image is available.
Output:
Push the image to your Vultr Container Registry.
Replace sjc.vultrcr.com with the URL of the region where your VCR is hosted.
Output:
Deploy a new containerized application using your Vultr Container Registry image.
Test access to the application using Curl on the host port 5000.
Output:
In this article, you installed Podman on Ubuntu 22.04 and deployed containerized applications. Podman allows you to build, store, and run containers on your server efficiently.
0 Comments
Be the first to comment and share your perspective with the community.