Linux Tactic

Secure Container Execution with Podman’s Rootless Feature

In the world of containerization, Docker has been the go-to tool for many developers. However, Docker requires root access to run, which poses significant security risks.

Enter Podman, a tool aimed at replacing Docker while ensuring maximum security by running containers as non-root users. In this article, we will explore the advantages of rootless containers and delve into the use of Podman for secure container execution.

What is Podman? Podman is a containerization tool that allows users to create, manage, and run containers on a host system without requiring root access.

Unlike Docker, which operates with the concept of a daemon, Podman runs containers as individual processes without the need for a background daemon. This means that Podman has a smaller attack surface and no single point of failure.

Advantages of Rootless Containers

Containers running as root pose significant security risks. In the event of exploitation or an attack, root access would provide easy access to the host system.

By running containers as non-root users, rootless containers provide an added layer of security by removing the privilege escalation vulnerability. Additionally, rootless containers allow for better container isolation, which means that if one container is compromised, it doesn’t put the others at risk.

Purpose of the Article

The purpose of this article is to explore Podman’s use for secure container execution. We will focus on the benefits of rootless containers and how Podman handles container execution securely.

Risks of Running Docker Command with Sudo

One of the significant security risks of running Docker is granting root access to the user running container images. Giving root access to an untrusted user with the `sudo` command could potentially be disastrous.

Running containers as root users also provides a gateway for attackers to exploit the host system. Privilege escalation can be possible as the attacker leverages the root access and pivots to other parts of the system.

Benefits of Running Podman as Non-Root User

Running containers as non-root users is a vast improvement in security. By default, Podman runs containers as non-root users, which means containers are isolated from the host system.

This feature allows Podman to provide better container security and provides a much safer alternative to running containers as root. Running Podman as a non-root user reduces the attack surface exposed to potential exploits.

Limitations of Rootless Podman Containers

Rootless Podman containers have some limitations compared to running containers as root. One of the significant restrictions is that rootless containers cannot use the host network namespace.

This means that containers can’t listen to privileged ports such as 80 and 443, which are reserved for root. Rootless containers also have limitations when it comes to sharing container images between pods or containers.

Getting Started with Rootless Podman

Before getting started with Podman, there are a few prerequisites to consider. You need to ensure that you have installed subuid/subgid on the system, which provides required user and group IDs. You should also ensure that SSL ports are available for external access.

Once these requirements are in place, you can start using Podman as a non-root user. By running the following command, you can confirm that Podman is running:


podman info



Running container images as root poses significant security risks. Docker is a popular tool but requires root access, which creates vulnerabilities in security.

Podman provides a secure alternative to Docker as it runs containers as non-root users. This article has covered the advantages of rootless containers, the risks of running Docker with `sudo`, benefits of running Podman as a non-root user, and the limitations of rootless containers.

If you require secure container execution, Podman is an excellent tool to consider.In our previous article, we explored Podman’s use for secure container execution by running containers as non-root users. In this article, we will delve deeper into configuring and running rootless containers with Podman.

We will cover installing `slirp4netns`, configuring subuid/subgid, binding ports less than 1024, where container images are stored, starting a container with Podman, verifying rootless container privileges, and troubleshooting rootless Podman containers.

Installing slirp4netns

Podman uses `slirp4netns` to provide user-mode networking, which helps to avoid the need for privileged network configuration. `slirp4netns` allows non-root users to access the network namespace by encapsulating the container’s network stack within a user namespace.

To install `slirp4netns`, you can run the following command:


$ sudo apt install slirp4netns


Configuring subuid/subgid

Subuid and subgid are user permissions that allow Podman to run containers as non-root users. To configure subuid/subgid on your system, you’ll need to add the user to the `subuid` and `subgid` files with the corresponding ranges.

You can achieve this by running the following commands (replace `` with your username):


$ echo “:$(id -u):65536″ >> /etc/subuid

$ echo “:$(id -g):65536″ >> /etc/subgid


Binding Ports Less Than 1024

By default, ports less than 1024 are reserved for root on Linux systems. To bind ports less than 1024 with Podman, you’ll need to use `sudo`.

However, this defeats the purpose of running containers as non-root users. One solution is to use a proxy server that redirects traffic to a higher port number.

Another solution is to bind ports greater than 1024 to container services. Bind-mounts can be used to map these higher ports to lower ports.

For example, to map port 8080 to port 80, use the following command:


$ podman run -p httpd


Where Container Images are Stored

When running containers as non-root users, container images are stored in the user directory `~/.local/share/containers`. You can view the downloaded images by running the following command:


$ podman images


Running Rootless Containers with Podman

Starting a Container with Podman

To start a container with Podman, first, ensure that the image is downloaded on your system. You can download an image from a registry using the `podman pull` command, followed by the image name.

Once the image is downloaded, start the container using the `podman run` command, followed by the image name. For example, to start a Caddy server container, use the following command:


$ podman run -d –name caddy -p 8080:80 caddy


Verifying Rootless Container Privileges

You can verify that a container is running with non-root user privileges by checking the container’s process list. Use the `podman top` command to list running container processes.

If the user ID and group ID of the container processes match that of the user running the container, then the container is running as a non-root user.

Troubleshooting Rootless Podman Containers

If you experience issues with your rootless containers, you can refer to Podman’s troubleshooting guide. Additionally, you can seek technical support from the Podman community via the mailing list or online forums.

A common reason for failing to start containers is port binding. Ensure that you use higher port numbers and that the ports are not already in use by another process.


In conclusion, we have explored the configuration and running of rootless containers with Podman. `slirp4netns` and subuid/subgid are crucial steps in configuring your system to run rootless containers securely.

Podman provides a convenient way to start and manage containers without requiring root access. If you encounter issues with your containers, Podman’s troubleshooting guide and community support may help to solve those problems.Podman provides secure and convenient rootless container management by running containers as non-root users.

We’ve explored installing and configuring `slirp4netns` and subuid/subgid on our systems, binding ports less than 1024, and where container images are stored. We’ve also looked at starting and verifying running rootless containers as well as troubleshooting any issues that may arise.

In this section, we’ll summarize the benefits of Podman for rootless containers, provide a recap of essential information, and suggest resources for further information.

Benefits of Podman for Rootless Containers

Podman provides various benefits for running rootless containers. The most significant advantage of Podman is container security.

Containerization aims at isolating applications from the host system and other containers to prevent the spread of malicious code. When one container is compromised, the damage is limited to that container.

Podman takes this concept a step further by running containers as non-root users, further isolating them from the host system and other containers. This enhances the security of containerized environments.

Additionally, Podman is a lightweight tool that is easy to use. It doesn’t require a daemon, which reduces the attack surface and maintenance overhead.

Podman also supports the same Dockerfile formats, making it a seamless transition for Docker users. Finally, Podman is open-source software, meaning users have the freedom to modify the software to fit their specific needs.

Recap of Important Information

In this article, we’ve covered a range of topics on configuring and running rootless containers with Podman. We began by looking at the benefits of rootless containers and introduced Podman as a secure and lightweight containerization tool that doesn’t require root access.

We then covered prerequisites, such as installing `slirp4netns` and configuring subuid/subgid. We discussed the limitations of running rootless containers, such as port binding and container image sharing.

Lastly, we looked at the process of starting and verifying rootless containers, troubleshooting container-related issues, and viewing stored container images.

Resources for Further Information

To learn more about Podman and rootless containers, there are several resources available. The Podman documentation provides a comprehensive guide to using and configuring Podman for rootless containers.

In addition, the Podman project has an active mailing list where users can address questions and provide feedback. Online forums, such as Reddit, additionally offer a platform for the Podman community to share issues and tips.

Finally, for more complex issues, users can get technical support by contacting the Podman team.


In conclusion, Podman provides a secure, lightweight, and easy-to-use containerization alternative. Running rootless containers mitigates security risks, and Podman’s feature set makes it a compelling alternative to Docker.

We hope this article has provided you with the necessary steps to configure and run your rootless container environment with Podman. Remember to refer to the official documentation, mailing list, and other resources for further information and support.

In conclusion, Podman offers a secure and efficient solution for running rootless containers, improving container security by running them as non-root users. By configuring `slirp4netns`, setting up subuid/subgid, and binding ports above 1024, users can ensure container isolation and minimize potential security vulnerabilities.

Additionally, the ability to start and manage containers without the need for root access makes Podman an attractive Docker alternative. Remember to consult the official documentation and seek technical support if needed.

Embrace Podman’s features and optimize your containerized environments with enhanced security and ease of use.

Popular Posts