Install Podman on Ubuntu 24.04 | Best and Rootless Container

Posted on

Install Podman on Ubuntu 24.04 | Best and Rootless Container

Podman is a powerful tool for running and managing containers. Similar to Docker, it offers a way to package and isolate applications, but with a focus on enhanced security. A key advantage of Podman is its ability to operate without requiring a central daemon or root privileges, making it a safer alternative for container management on Ubuntu 24.04. With Install Podman on Ubuntu 24.04, you gain the ability to effortlessly create, run, and manage containers without the complexities and potential security risks associated with traditional container solutions.

You can now proceed to the guide steps below on the Orcacore website to install Podman and use it on your Ubuntu 24.04.

Steps To Install and Configure Podman on Ubuntu 24.04

To complete the Install Podman on Ubuntu 24.04 setup, you must log in to your server as a non-root user with sudo privileges. If you are looking for a guide to create a sudo user, you can check this guide on How To Add a Sudo User on Ubuntu 24.04.

1. Installing Podman with APT Command

The Podman packages are conveniently available in the default Ubuntu 24.04 APT repository. This allows for easy installation using the APT package manager. First, update the system’s package lists and upgrade existing packages to their latest versions:

sudo apt update && sudo apt upgrade -y

Then, install Podman with the following command:

sudo apt install podman -y

Once the installation is complete, verify it by checking the Podman version:

podman --version
**Output**
podman version 4.9.3

2. Start and Enable Podman on Ubuntu Linux

After the installation of Install Podman on Ubuntu 24.04 is complete, you need to start and enable the Podman service. This ensures that Podman is running and will automatically start upon system boot. Use the following commands:

sudo systemctl start podman.socket
sudo systemctl enable podman.socket

Then, check if the Podman service is active and running on Ubuntu 24.04 with the following command:

sudo systemctl status podman.socket

The output should indicate that the podman.socket service is active and running.

Check Podman Status

To get detailed information about the installed Podman package and its configuration, use the podman info command:

podman info

The output will provide a comprehensive overview of the Podman environment, including storage configuration, network settings, and other relevant details.

information about the installed Podman package

3. Configure Podman Container Registries

Podman allows you to search for and pull container images from various registries. You can configure the list of registries that Podman will search by editing the registries.conf file. This file is located at /etc/containers/registries.conf.

To edit the registry file, open it with your desired text editor, such as Vi Editor or Nano Editor:

sudo vi /etc/containers/registries.conf

Add the following line to the end of the file to include RedHat and Docker registries:

unqualified-search-registries = [ 'registry.access.redhat.com', 'registry.redhat.io', 'docker.io']

Configure Podman Container Registries

Save and close the file. This configuration will instruct Podman to search these registries in the specified order when using commands like podman search or podman pull.

To apply the changes, restart the Podman service:

sudo systemctl restart podman.socket

4. How To Work with Podman Container Manager?

Now that Podman is installed and configured, let’s explore how to use it to search for images, pull images, and create containers.

Podman Searching Images

Searching for images with Podman is straightforward. Use the podman search command followed by the name of the image you’re looking for. For example, to search for Ubuntu images:

podman search ubuntu

Podman Searching Images

Podman Pulling or Downloading Images

Once you’ve found the image you want, you can pull it (download it) using the podman pull command:

podman pull ubuntu

Podman Pulling or Downloading Images

Listing Downloaded Podman Images

To see a list of all the images you’ve downloaded, use the podman images command:

podman images

Listing Downloaded Podman Images

Create a Container with Podman Downloaded Images

You can create a container from a downloaded image using the podman run command. The following command creates a container named container1 from the ubuntu image:

podman run -dit --name container1 ubuntu

Then, you can access your container by using the following command:

podman attach container1

You will see that your command prompt changes to your container ID:

Access Podman Container

To start your container, you can use the command below:

podman start <container-id> or <name>

To stop your container, you can use the following command:

podman stop <container-id> or <name>

You can also check the official docs page to get Podman commands and their usage.

Conclusion

Install Podman on Ubuntu 24.04 is a powerful and secure tool for managing containers on Ubuntu 24.04. Unlike Docker, it works without a background service and doesn’t require root access, making it a safer choice. Whether you’re a beginner or an experienced developer, Podman provides an easy and efficient way to run containers on your system.

Hope you enjoy using Install Podman on Ubuntu 24.04. Please subscribe to us on Facebook, Instagram, YouTube, and X.

Also, you may like to read the following articles:

Docker CE Setup For Ubuntu 24.04

Podman Installation on Fedora 39

Install Podman on Ubuntu 22.04

Installing Podman on Debian 12 Bookworm

FAQs

How is Podman different from Docker?

Podman runs without a daemon and allows users to manage containers without root privileges, making it more secure than Docker.

Do I need root access to use Podman?

No, Podman allows rootless containers, meaning you can run it as a regular user without administrative privileges.

Is Podman better than Docker?

It depends on your needs. Podman is more secure and lightweight, while Docker has broader adoption and additional tools like Docker Compose.

Alternative Solutions for Container Management on Ubuntu 24.04

While Podman offers a robust and secure containerization solution, other alternatives can be considered depending on your specific requirements and environment. Here are two alternative approaches:

1. LXD/LXC

LXD is a container management system built on top of LXC (Linux Containers). It offers a more traditional system container approach, focusing on running full operating systems within containers. Unlike Docker and Podman, which primarily target application containerization, LXD/LXC provides a lighter-weight alternative to virtual machines.

Explanation:

LXD utilizes the Linux kernel’s built-in containerization features to create isolated environments. It manages full system images, allowing you to run entire Ubuntu instances (or other Linux distributions) within containers. This is beneficial for scenarios where you need to replicate a full server environment or require system-level services within a container. LXD offers features like live migration, snapshots, and a REST API for management. It can be installed via snap.

Installation and basic usage:

sudo snap install lxd
sudo lxd init #Interactive setup
lxc launch ubuntu:24.04 my-lxd-container # Launching Ubuntu 24.04
lxc list # listing containers
lxc exec my-lxd-container -- bash #accessing container

LXD/LXC is a great solution if you need system-level containerization.

2. Docker with Rootless Mode

While the original article positions Podman as a rootless alternative to Docker, Docker itself has evolved and now supports rootless mode. This allows users to run Docker containers without requiring root privileges, addressing a major security concern associated with traditional Docker setups.

Explanation:

Rootless Docker leverages user namespaces to isolate the Docker daemon and containers from the host system. This prevents containers from gaining elevated privileges and reduces the risk of security breaches. While it may require some initial configuration, rootless Docker provides a viable alternative for those who are already familiar with the Docker ecosystem and its tooling.

Installation and configuration:

First, ensure you have Docker installed. If not, install it following the official Docker documentation. Then, enable rootless mode:

sudo apt update
sudo apt install -y docker.io

# Enable rootless mode (example for systemd)
dockerd-rootless-setuptool.sh install

Follow the instructions provided by the dockerd-rootless-setuptool.sh script. You might need to log out and log back in for the changes to take effect.

After logging back in, you should be able to run Docker commands as a non-root user:

docker run -d -p 80:80 nginx

These alternative solutions offer different approaches to container management, each with its own strengths and weaknesses. Choosing the right solution depends on your specific needs, technical expertise, and security requirements. Install Podman on Ubuntu 24.04 is an excellent choice for rootless, daemon-less containerization, while LXD/LXC provides system-level containerization, and rootless Docker offers a more familiar environment for those already invested in the Docker ecosystem.

Leave a Reply

Your email address will not be published. Required fields are marked *