How to Install and Use Podman on Ubuntu 26.04 and 24.04

Share

To install Podman on Ubuntu 26.04 or 24.04, run sudo apt update && sudo apt install -y podman. Ubuntu supplies it through the Universe APT repository; no third-party repository is needed.

Podman runs applications in containers: isolated processes with their own application files and dependencies. This guide installs the command-line tool, checks rootless operation, runs a local web server, saves data in a volume and builds a small image. If a step fails, leave a comment with the error or contact us.

Before you begin
  • Ubuntu 26.04 LTS or 24.04 LTS on a regular desktop, server or VM, a sudo account, internet access and space for container images.
  • Use sudo for APT and account administration. Run all Podman commands as your regular user unless explicitly stated otherwise.
  • Use a normal login session and local Linux home storage. Nested containers, network-mounted home directories and restricted hosting need additional configuration.
  • Only run images you trust. Rootless containers limit privileges but are not a guarantee that an untrusted application is safe.

1. Install Podman with APT

Step 1: Check Ubuntu and the available package

Confirm the release and refresh APT:

Ubuntu terminal
cat /etc/os-release
sudo apt update
apt policy podman

Check that VERSION_ID is 26.04 or 24.04. If APT shows no candidate on a minimal image, enable Universe using the optional commands below, then install.

Minimal image: enable Universe if needed

Skip this if apt policy already lists a candidate. The repository helper may need installing first:

Ubuntu terminal
sudo apt install -y software-properties-common
sudo add-apt-repository -y universe
sudo apt update
Step 2: Install the Ubuntu package

The same command works on both releases:

Ubuntu terminal
sudo apt update && sudo apt install -y podman

Standard APT settings install recommended helper packages automatically, including uidmap, dbus-user-session, passt and slirp4netns. If you used --no-install-recommends, or configured APT to skip recommendations, use the repair command in troubleshooting. See Podman installation instructions.

Step 3: Check the installed version

Read the version and package origin:

Ubuntu terminal
podman --version
apt policy podman

Ubuntu updates can change the package revision. APT installs Ubuntu’s supported archive version, which may differ from the newest upstream release.

Ubuntu 26.04 versus 24.04

Ubuntu 26.04: Podman 5.7.x, with pasta from the passt package as the default rootless networking tool. The base archive package reviewed is 5.7.0+ds2-3build1.

Ubuntu 24.04: Podman 4.9.x, with slirp4netns as the default rootless networking tool. The base archive package is 4.9.3+ds1-1ubuntu0.1; the updates pocket currently lists 4.9.3+ds1-1ubuntu0.2.

These are defaults for fresh installations. Existing containers and containers.conf overrides can retain other settings. Netavark is the container network backend; pasta and slirp4netns provide rootless connectivity, so a netavark entry in podman info does not identify the rootless helper by itself. Check the 26.04 package and 24.04 package for current archive details.

2. Verify Rootless Operation

Step 1: Check your user and ID mappings

Run these without sudo:

Ubuntu terminal
id -u
grep "^$USER:" /etc/subuid /etc/subgid
podman info

Your user ID should be nonzero. The grep command should show a range in each file, such as username:100000:65536. In podman info, find rootless: true under host security. Ranges need not start at 100000. If either mapping is missing or info fails, use the mapping repair below before continuing.

Step 2: Run a test container

Use the full registry and repository name:

Ubuntu terminal
podman run --rm quay.io/podman/hello

Expect a friendly Podman greeting. The first run downloads the image; --rm removes the container after it exits, while keeping the downloaded image.

Podman does not require starting a central daemon for these commands, and Ubuntu does not need podman machine init for this native Linux setup. Do not switch to sudo podman to bypass an error: root has separate containers, images and storage.

3. Run a Local Web Server

Step 1: Start Nginx in the background

Run a trusted public image and publish it only on localhost:

Ubuntu terminal
podman run -d --name ubuntu-web -p 127.0.0.1:8080:80 docker.io/library/nginx:alpine
podman ps

The command prints a container ID. -d detaches from the terminal; --name makes later commands predictable. Host port 8080 forwards to port 80 inside the container. Rootless users normally cannot bind host ports below 1024, even when the container process uses port 80 internally.

Step 2: Open and inspect the server

On this Ubuntu machine, visit http://127.0.0.1:8080 in a browser. You should see the Nginx welcome page. Inspect logs and run a command inside it:

Ubuntu terminal
podman logs --tail 20 ubuntu-web
podman exec ubuntu-web nginx -v

127.0.0.1 prevents network-wide exposure. If Ubuntu is a remote server, that address refers to the server itself; use an SSH tunnel to view it from your computer. No firewall opening is needed for this local example.

Step 3: Stop and restart the same container

Keep its identity and writable layer while restarting it:

Ubuntu terminal
podman stop ubuntu-web
podman ps -a
podman start ubuntu-web

Stopped containers remain listed with -a. Starting one resumes it; running the original command again tries to create another container and fails if the name is already taken.

Step 4: Remove the practice server

When finished with the Nginx example:

Ubuntu terminal
podman stop ubuntu-web
podman rm ubuntu-web

Removing a container discards its writable layer. Use a volume for data that must outlive a container.

4. Keep Data in a Named Volume

Step 1: Create and write to a practice volume

A named volume is storage that Podman manages separately from the container:

Ubuntu terminal
podman volume create ubuntu-demo-data
podman run --rm -v ubuntu-demo-data:/data docker.io/library/alpine:latest sh -c 'printf "%s\n" "Saved outside the container" > /data/message.txt'

The short-lived Alpine container writes a text file and is removed. The volume remains. These commands overwrite message.txt inside this dedicated practice volume if you repeat them.

Step 2: Read it from a new container

Mount the same volume read-only in a second container:

Ubuntu terminal
podman run --rm -v ubuntu-demo-data:/data:ro docker.io/library/alpine:latest cat /data/message.txt
podman volume inspect ubuntu-demo-data

Expect Saved outside the container. The second container has its own filesystem but sees the same volume data. A volume is persistent storage, not a backup; back up valuable data separately.

Bind mounts: ownership and security labels

A bind mount shares a specific host directory. Rootless UID mappings can make its files unwritable to a container’s application user. The :U option recursively changes ownership of the source to match the container user; it changes host files and can be slow. Use it only on a dedicated directory whose ownership you intend to change, never your whole home directory.

:Z applies a private SELinux label where SELinux is enabled; :z is for sharing between containers. These are labeling options, not ownership fixes. Standard Ubuntu uses AppArmor rather than SELinux, so do not add :Z as a generic Ubuntu permission repair. The Podman run reference explains mount options.

5. Build an Image with a Containerfile

Step 1: Make a fresh project directory

Use a unique directory so the example does not overwrite an existing project:

Ubuntu terminal
podman_demo_dir=$(mktemp -d "$HOME/podman-demo.XXXXXX") && cd "$podman_demo_dir"
pwd

Stay in this directory for the next two steps. A Containerfile describes how to build an image; it is a recipe, while a container is a running or stopped instance of an image.

Step 2: Create the recipe

Write this small Containerfile in the new directory:

Ubuntu terminal
cat > Containerfile <<'EOF'
FROM docker.io/library/alpine:latest
RUN printf "%s\n" "Hello from an Ubuntu-built image" > /message.txt
CMD ["cat", "/message.txt"]
EOF

FROM uses a fully qualified image name. RUN creates a file during the build. CMD selects the command executed when a container starts. Review recipes before building; their instructions execute code.

Step 3: Build and run it

Tag the local image explicitly with localhost:

Ubuntu terminal
podman build -t localhost/ubuntu-greeting:demo .
podman run --rm localhost/ubuntu-greeting:demo

The final dot sets this directory as the build context. Expect Hello from an Ubuntu-built image. localhost marks this as a local image name; no registry service is needed. These moving tags are convenient for learning; use a reviewed version tag or digest for reproducible deployments.

6. Keep Rootless Services Available After Logout

For background rootless workloads on a server, lingering keeps your user systemd manager available after your SSH session ends. Enable it for your own account:

Ubuntu terminal
loginctl enable-linger "$USER"
loginctl show-user "$USER" -p Linger

Expect Linger=yes. Your system may request administrator authentication; use sudo for enable-linger if permission is denied. Logind policies can also affect logout behavior. Lingering does not turn a stopped container into a service or configure automatic container startup after reboot.

For a long-running service, define a user systemd service through Quadlet and pair it with lingering. The exact supported keys differ between Podman 4.9 and 5.7; use the installed man podman-systemd.unit as your version-specific reference. This basic guide leaves boot-time service configuration for a separate deployment walkthrough.

7. Troubleshooting

Issue 1: Short-name resolution fails

An error such as short-name "nginx" did not resolve to an alias and no unqualified-search registries are defined means Podman cannot choose a registry. Ubuntu’s default registry configuration does not define an unqualified-search list; aliases or local administrator settings may change the result. Use docker.io/library/nginx:alpine instead of nginx. All image examples here name their registry explicitly.

Optional: if you intentionally want Docker Hub as your short-name search registry, create ~/.config/containers and edit ~/.config/containers/registries.conf. Preserve existing entries rather than replacing the file. Add this top-level TOML setting before any table headers:

registries.conf setting
unqualified-search-registries = ["docker.io"]

Use nano to edit the file (install it first if missing):

Ubuntu terminal
sudo apt install -y nano
mkdir -p ~/.config/containers
nano ~/.config/containers/registries.conf

Personal registry configuration can override the system configuration. Explicit names remain clearer and avoid accidentally pulling a similarly named image from another source.

Issue 2: Rootless helpers are missing

If you disabled APT recommendations or see missing newuidmap, pasta or slirp4netns errors, install the helper packages explicitly:

Ubuntu terminal
sudo apt update && sudo apt install -y uidmap dbus-user-session passt slirp4netns

The passt package supplies pasta. Log out and back in if the user session bus was newly installed, then retry podman info. Do not change the system’s networking default just to copy a guide written for another Podman release.

Issue 3: Missing subordinate UID or GID ranges

Inspect all allocations before adding one:

Ubuntu terminal
cat /etc/subuid
cat /etc/subgid

An administrator must choose unused, nonoverlapping ranges. The following example uses 100000-165535, a block of 65,536 IDs. Run it only if this entire range is free in the corresponding file and your account has no existing allocation there. If only one file is missing an entry, add only that mapping. Do not blindly reuse this range on a multi-user system:

Ubuntu terminal
sudo usermod --add-subuids 100000-165535 "$USER"
sudo usermod --add-subgids 100000-165535 "$USER"

Save work and stop your rootless containers before migrating: this can interrupt workloads. Apply the new mappings as your regular user, then recheck:

Ubuntu terminal
podman system migrate
grep "^$USER:" /etc/subuid /etc/subgid
podman info

Do not casually change ranges already used by stored container files; existing ownership may need a planned migration.

Issue 4: Port 8080 or the container name is already in use

Inspect containers and the host listener:

Ubuntu terminal
podman ps -a
ss -ltn '( sport = :8080 )'

Restart ubuntu-web if it already exists. Otherwise remove only the stopped practice container you no longer need, or choose another unused high host port, such as 8081, when creating a new container. Keep the 127.0.0.1 binding. Avoid low ports and do not use --privileged as a workaround.

Issue 5: A user namespace or AppArmor error

Use the Ubuntu APT package and its supplied profiles, then read the actual denial:

Ubuntu terminal
podman --log-level=debug info
sudo journalctl -k --since "10 minutes ago"

Review logs for AppArmor or user-namespace denials. A manually downloaded binary may lack the Ubuntu profile path coverage. Do not disable AppArmor or system-wide user-namespace restrictions as a generic fix. Restricted VMs or nested containers may require changes from their administrator.

8. Update Podman and Container Images

Update the Ubuntu package

Use APT for the container engine:

Ubuntu terminal
sudo apt update && sudo apt install --only-upgrade podman

Check podman --version afterward. An APT update does not replace images already downloaded or update an application inside an existing container.

Refresh an image separately

Fetch the current image for the tag used in the web example:

Ubuntu terminal
podman pull docker.io/library/nginx:alpine

Existing containers retain their image. Recreate a service with the reviewed new image when ready, preserving its volumes and configuration. Do not remove a working service until you have a recovery plan for valuable data.

9. Remove Practice Data or Uninstall Podman

Option A: Remove only this guide’s remaining practice data

The Nginx container was removed earlier. When you no longer need the greeting image and message volume:

Ubuntu terminal
podman image rm localhost/ubuntu-greeting:demo
podman volume rm ubuntu-demo-data

The second command permanently deletes the practice message. It fails if a container still uses the volume. Your Containerfile project directory remains in your home folder. This targeted cleanup leaves other workloads intact.

Option B: Full removal deletes your Podman workloads

Back up everything you want to keep first. The next command removes all of your Podman containers, pods, images, networks and volumes, including unrelated projects. Stop user systemd/Quadlet services first so they cannot recreate containers. Do not use a full reset just to uninstall one example.

Run the reset as your regular user, before purging the package. Read its confirmation prompt:

Ubuntu terminal
podman system reset

Then remove the Ubuntu package:

Ubuntu terminal
sudo apt purge podman

APT alone does not remove user-owned rootless data in ~/.local/share/containers or personal settings in ~/.config/containers. Reset removes the configured container storage and runtime roots, normally including ~/.local/share/containers/storage; it is not a promise to delete every personal configuration file. Review leftover configuration and custom XDG/storage paths separately. Other container tools may share these directories, so do not recursively delete them without checking.

Do not run sudo podman system reset to clean your regular account: it targets root’s separate storage. Package dependencies may also be used by other software; review APT’s proposed removals before any autoremove. See the reset reference.

If you enabled lingering solely for this experiment and no other user services need it, undo that setting:

Ubuntu terminal
loginctl disable-linger "$USER"

Frequently Asked Questions

Do I need sudo to run Podman on Ubuntu?

Use sudo to install packages and administer user ID mappings. Run the examples as your regular account. Rootless Podman and sudo podman have separate containers, images and storage.

Why does Podman reject a short image name such as nginx?

Without a matching alias or configured unqualified-search registry, Podman cannot choose the image source. Use docker.io/library/nginx:alpine to identify Docker Hub and the repository explicitly.

Can a rootless container use port 80?

It can use port 80 inside its own network namespace. Binding host ports below 1024 normally requires extra privileges or system policy changes. Publish the container on localhost port 8080 for this tutorial.

Does removing a container delete its named volume?

A named volume persists when the example container is removed. Removing that volume or running podman system reset destroys its data. Persistent storage still needs a separate backup.

Does lingering start my containers after a reboot?

No. Lingering keeps the user systemd manager available without an active login. Configure a user service, such as a Quadlet unit supported by your installed Podman version, for automatic container startup.

Does apt purge podman delete rootless container data?

No. APT removes the package rather than all user-owned container data and settings. For a deliberate full cleanup, back up data and run podman system reset as the regular user before purging Podman. Review remaining personal configuration separately.

More Ubuntu guides: Check your Ubuntu version · Useful Linux commands · Edit projects with Visual Studio Code