How to Install Podman on Ubuntu: Rootless Container Alternative to Docker
Learn how to install podman on ubuntu rootless with subuid/subgid user mapping, container registries, podman compose, and systemd service generation.

5 min read
Learn how to install podman on ubuntu rootless with subuid/subgid user mapping, container registries, podman compose, and systemd service generation.
- Prerequisites and Supported Releases
- Step 1: Installing Podman and Container Utilities
- Step 2: Configuring Rootless User SubUID and SubGID Mappings
Containerization is a foundational pillar of modern software engineering, traditionally dominated by Docker.
However, traditional Docker architectures rely on a monolithic background daemon (dockerd) that runs with full root privileges on the host system.
Podman (Pod Manager) is a daemonless, open-source container engine designed specifically to run OCI-compliant containers and pods rootlessly out of the box.
Because rootless Podman maps unprivileged host user IDs to root inside container namespaces, any security vulnerability inside a container is contained without compromising the underlying host.
In this guide, we walk through how to install podman on ubuntu rootless, configure user namespace mappings, pull container images, and generate systemd service units.
Comprehensive guide to installing and configuring Podman on Ubuntu 24.04 LTS and 22.04 LTS. Learn how to run OCI containers entirely without root privileges or a background daemon, configure subuid/subgid user namespaces, manage pods, and deploy multi-container stacks with podman-compose.
Prerequisites and Supported Releases
This guide is thoroughly verified on Ubuntu 24.04 LTS (Noble Numbat) & Ubuntu 22.04 LTS. The instructions apply cleanly to cloud instances (AWS EC2, Google Compute Engine, DigitalOcean, Hetzner), bare-metal servers, and local virtual machines.
Before proceeding, ensure you have the following requirements satisfied:
- A server or workstation running Ubuntu 24.04 LTS or Ubuntu 22.04 LTS.
- A standard unprivileged user account with
sudoaccess for initial installation. - Access to a bash terminal shell.
- Basic understanding of container concepts (images, ports, volumes).
Step 1: Installing Podman and Container Utilities
Ubuntu 24.04 LTS includes Podman natively in the official software repositories.
Along with the core podman binary, install podman-compose and complementary tools:
Refresh package lists and install Podman using apt:
# Update package indexes:
sudo apt update
# Install Podman and container tools:
sudo apt install -y podman podman-compose
# Verify installed Podman version:
podman --version
# Output: podman version 4.9.3
Step 2: Configuring Rootless User SubUID and SubGID Mappings
Rootless Podman relies on user namespaces provided by the Linux kernel to map unprivileged host user IDs to container IDs.
The system manages these ranges through two configuration files: /etc/subuid and /etc/subgid.
Verify that your user account has an assigned range of subordinate UIDs and GIDs (typically 65,536 IDs):
# Check subordinate UID allocation for your user (e.g. sysadmin):
grep "sysadmin" /etc/subuid
# Output: sysadmin:100000:65536
# Check subordinate GID allocation:
grep "sysadmin" /etc/subgid
# Output: sysadmin:100000:65536
# If missing, add them manually:
sudo usermod --add-subuids 100000-165535 sysadmin
sudo usermod --add-subgids 100000-165535 sysadmin
Enabling Systemd User Lingering
By default, background processes launched by unprivileged users terminate when the user logs out of their terminal session.
To ensure that rootless Podman containers continue running persistently across reboots and logouts, enable user lingering with loginctl:
# Enable systemd lingering for active user:
loginctl enable-linger $USER
# Verify lingering status:
loginctl show-user $USER | grep Linger
# Output: Linger=yes
Step 3: Running Your First Rootless Container
Because Podman is CLI-compatible with Docker, virtually all Docker commands work seamlessly with Podman.
Run a test Nginx web server container as your regular unprivileged user (without sudo):
Note that rootless containers cannot bind to privileged ports below 1024 by default, so bind to port 8080:
# Run rootless Nginx container on port 8080 (NO sudo!):
podman run -d --name webserver -p 8080:80 docker.io/library/nginx:alpine
# List running containers:
podman ps
# Output:
# CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
# 3f8a1c9b2e4d docker.io/library/nginx:alpine nginx -g daemon o... 5 seconds ago Up 5 seconds 0.0.0.0:8080->80/tcp webserver
# Test connection via curl:
curl -I http://localhost:8080
# HTTP/1.1 200 OK
Step 4: Generating Systemd Service Units for Containers
One of Podman's most powerful native features is integrating directly with systemd.
Podman can automatically generate systemd service unit files that manage container lifecycles, healthchecks, and auto-restarts upon boot.
Generate and enable a systemd service unit for your rootless container:
# Create local user systemd unit directory:
mkdir -p ~/.config/systemd/user/
# Generate unit file from running container:
podman generate systemd --new --files --name webserver
# Move generated unit file:
mv container-webserver.service ~/.config/systemd/user/
# Reload user systemd daemon and enable service:
systemctl --user daemon-reload
systemctl --user enable --now container-webserver.service
Rootless Pods: Grouping Multiple Containers Together
Unlike Docker which focuses purely on individual containers, Podman natively implements the Kubernetes concept of a Pod.
A pod is a group of one or more containers that share the same network namespace, IP address, and port bindings.
Containers within the same pod communicate with each other over localhost with ultra-low latency:
# Create a rootless pod exposing port 8080:
podman pod create --name web-pod -p 8080:80
# Launch an Nginx web server inside the pod:
podman run -d --pod web-pod --name proxy-app docker.io/library/nginx:alpine
# Inspect the pod and its constituent containers:
podman pod ps
podman ps --pod
Building Container Images with podman build
Podman replaces docker build directly using standard Dockerfile or Containerfile syntax.
You can build OCI-compliant container images rootlessly without running a daemon:
Build images and push to external registries such as GitHub Packages or Quay.io:
# Build an image from a local Containerfile or Dockerfile:
podman build -t my-custom-app:latest .
# Inspect local image repository:
podman images
Managing Storage and Cleaning Unused Containers
Because rootless containers store images and layers in user home directories (~/.local/share/containers/storage/), disk space management is crucial on multi-tenant servers.
Podman provides powerful disk analysis and cleanup subcommands:
Prune stopped containers, dangling build layers, and unused networks to reclaim filesystem space:
# Inspect disk space consumed by rootless containers and images:
podman system df
# Reclaim space by pruning all unused container resources:
podman system prune -a --volumes -f
Configuring Volume Bind Mounts and Permission Flags
When mounting directories from the host filesystem into rootless containers, Linux permission boundaries and mandatory access controls must be respected.
Podman supports appending the :Z flag to volume options, which automatically relabels the target directory with private container context:
This ensures the unprivileged container process has write access to host directory mounts without altering host ownership:
# Run container with private relabeled volume mount:
podman run -d --name app-service -v ~/app-data:/data:Z -p 8080:80 nginx:alpine
# Inspect active volume mounts:
podman inspect app-service --format '{{.Mounts}}'
Troubleshooting and Common Errors
When configuring Ubuntu servers, unexpected permission errors, network timeouts, or lock contention can occur. Review these common issues and verified resolutions:
Error: cannot setup namespace using newuidmap: exit status 1
Cause: Missing subuid or subgid mappings for the active user account.
Resolution: Configure subuid and subgid ranges using usermod --add-subuids.
sudo usermod --add-subuids 100000-165535 $USER && sudo usermod --add-subgids 100000-165535 $USER
Error: rootlessport: cannot bind to ports below 1024
Cause: Linux security policy prevents unprivileged users from binding to low-numbered privileged ports.
Resolution: Bind containers to high ports (e.g. 8080 or 8443) or adjust net.ipv4.ip_unprivileged_port_start sysctl.
sudo sysctl -w net.ipv4.ip_unprivileged_port_start=80
Security Best Practices and Hardening
Running containers rootlessly provides defense-in-depth: if an attacker escapes the container, they only acquire unprivileged host access.
Store persistent container volumes in your user's home directory with standard permissions.
Never run sudo podman unless you specifically require root-level networking or hardware device pass-through.
Related Ubuntu Tutorials and Documentation
Deepen your Linux system administration skills with our related production-tested guides:
- How to Install Docker on Ubuntu — Compare Podman rootless containers with the traditional Docker daemon.
- Initial Server Setup on Ubuntu 24.04 LTS — Configure unprivileged user accounts and firewalls for container nodes.
- How to Install and Configure Caddy on Ubuntu 24.04 — Set up reverse proxies for rootless Podman container applications.
Authoritative References and Official Documentation

The Linux Command Line, 2nd Edition: A Complete Introduction
Frequently Asked Questions
Quick answers to common questions and configurations
podman-compose or enable the Podman Docker-compatible socket (systemctl --user enable --now podman.socket) and use the standard Docker Compose CLI seamlessly.crun or runc) without a persistent background service.alias docker=podman to your ~/.bashrc file to transition existing workflows effortlessly.~/.local/share/containers/storage/.Editorial Disclosure: Website Vidya is supported by our readers. When you purchase hosting, tools, or software through our verified partner links, we may earn an affiliate commission at no extra cost to you. We only recommend solutions we trust and rigorously verify.
Rajesh Ray
I’m Rajesh Rai, a full-stack developer, Linux administrator, and technology enthusiast passionate about making complex technology easier to understand and use.
Most Read Guides
TrendingUbuntu Server Not Booting? 10 Simple Steps to Fix It Fast
How to Create a 3D Button in HTML and CSS: Easy Steps
How to Install Python and Pip on Ubuntu 24.04 LTS
How to Install Nginx on Ubuntu 24.04
How to Install Python on Ubuntu 24.04 LTS
Related Technical Guides
Tested runbooks, server administration walkthroughs, and troubleshooting guides
Join the Conversation & Perspective
Have thoughts, counterpoints, or reflections on this story? Engage directly with fellow readers and editorial contributors.
No comments on this guide yet. Be the first to share your thoughts or ask a question!