Podman has emerged as a significant player in the containerization landscape, offering a daemoness alternative to Docker that aligns with the Open Container Initiative (OCI) standards. Its popularity stems from its simplicity and the fact that it doesn’t require a background daemon to run, making it a secure choice for managing containers.
Here’s a comprehensive guide to installing Podman on Ubuntu 24.04, also known as Noble Numbat.
How to Install Podman on Ubuntu 24.04
How to Manage Podman on Ubuntu 24.04
How to Install Podman on Ubuntu 24.04
Podman is a daemonless container engine that provides a command-line interface (CLI) compatible with Docker. It’s a great alternative to Docker, especially for environments where running a daemon might not be ideal.
To install Podman on Ubuntu 24.04, follow the below steps:
Step 1: Update the Package Lists
First of all, update the repository list before installing any package:
sudo apt update

Step 2: Install Podman
Podman is readily available in the Ubuntu repositories. You can install Podman directly from the Ubuntu repositories using the “apt” package manager. Install it using the following command:
sudo apt install podman

The installation process automatically handles the dependencies and configures Podman on your system.
Step 3: Verify Installation
After the installation is complete, you can verify it by checking the version of Podman installed:
podman version

This command returns the version of Podman that was installed, confirming that the installation is successful.
By following these steps, you have Podman successfully installed on your Ubuntu 24.04 system and ready to use.
How to Manage Podman on Ubuntu 24.04
Once you’ve installed Podman, you can start managing your containers using the following commands:
Pull the Image
Podman allows you to manage container images effectively. You can pull an image from a registry. Before creating a container, you need to pull the desired image. Now, pull the Ubuntu image as below:
podman pull ubuntu:latest

Running Containers
For running the container, utilize the “run” command by specifying the image name such as ubuntu as below:
podman run -it ubuntu bash

This command runs an Ubuntu container and provides you with an interactive shell.
List Containers
This podman ps command provides the current status of your container service, ensuring that it’s operational:
podman ps

And list all downloaded images with:
podman images

Note: For removing the image, utilize the podman image rm <image_id> command.
Create the Container
Now, utilize the podman create command to create the new container. This command creates a container but doesn’t start it:
podman create --name my_ubuntu_container ubuntu:latest

Here, –name my_ubuntu_container assigns a name to the container, and ubuntu:latest specifies the image to use.
Start the Container
For starting the container on Ubuntu, utilize the podman start command as below:
podman start my_ubuntu_container

Users can also check the services via the ls command:
ls *.service

Note: For stopping a container, use podman stop <container_id>.
Generate a Systemd Unit File
Systemd is the init system for modern Linux distributions, responsible for managing system services. Let’s generate the systemd unit file via podman’s command:
podman generate systemd --new --name my_ubuntu_container

This command creates a service file named my_ubuntu_container.service in /etc/systemd/system or home directory. You can customize this file further based on your needs.
For system-wide services, the directory is “/etc/systemd/system”. Let’s move it to there:
sudo mv container-my_ubuntu_container.service /etc/systemd/system

Enable and Start the Service
With the systemd unit file in place, users can now enable the service to start on boot and start the service immediately if desired. This command tells systemd to create the necessary symlinks to start your container service at boot time.
sudo systemctl enable container-my_ubuntu_container.service
sudo systemctl start container-my_ubuntu_container.service

This initiates the container based on the configurations set in the service file.
Check the Service Status
Users can verify that your container started successfully by checking the status of the systemd service:
sudo systemctl status container-my_ubuntu_container.service

Use podman info to get detailed information about your Podman environment. Explore the podman machine command for managing remote containers.
Consider using Docker Compose for defining and running multi-container applications.
By following the steps outlined above, you can easily install Podman on Ubuntu 24.04 and start deploying your containers with ease.
Conclusion
Podman offers a robust and secure way to manage containers without the need for a daemon, aligning with modern container management practices. Installing Podman on Ubuntu 24.04 is a straightforward process, whether you choose to use the official repositories, the Kubic project repository, or build from source. Each method has its own advantages, and the best one for you depends on your specific needs and preferences. With Podman installed, you’re now ready to explore the world of containerization on your Ubuntu system.
Frequently Asked Questions
sudo apt update
,
sudo apt install -y podman
podman run
and podman build
, work similarly to Docker. podman --version
Leave feedback about this