Containers and Kubernetes · Intermediate · 16 min
Run rootless containers with Podman on Ubuntu
By Padding · Updated 18 Nov 2026
Ubuntu 26.04 · Podman 5.7 (Ubuntu archive; upstream 6.2.1)
You will install Podman 5.7 on Ubuntu 26.04, run an Nginx container as your own user with no daemon and no root, see how user namespaces map its users to your subordinate ID range, and know where the Docker alias and podman compose stop matching Docker.
On this page
Docker runs a long-lived daemon as root, and every docker command asks that daemon to do the work. Anyone in the docker group can therefore start a container that mounts / and edits it as root. Podman takes a different route. There is no daemon: podman run forks the container process itself, under your own user ID, and the container's "root" is root only inside a user namespace. If something breaks out of the container, it lands on the host as you, not as root.
In this tutorial you install Podman from the Ubuntu 26.04 archive, look at the ID ranges that make rootless containers work, run a small web server, and compare the everyday commands with Docker's. You also see the two places where rootless behaviour surprises people (ports below 1024 and networking) and the limits of using Podman as a drop-in for Docker.
A note on versions: Ubuntu 26.04 ships Podman 5.7. Upstream has moved on to 6.2, and Podman 6 removed slirp4netns, CNI networking, iptables and cgroups v1 support. Everything here works the same on both, and where a 6.x difference matters, the step says so. If you read the upstream docs, check which version they describe.
Step 1 · Install Podman and confirm it runs rootless
Install Podman with the two helpers rootless mode depends on: uidmap provides newuidmap and newgidmap, which set up the user namespace, and passt provides pasta, the rootless network tool. Both are recommended packages, so a default install pulls them in; naming them makes sure they are there even if your apt is set to skip recommends.
sudo apt update
sudo apt install -y podman uidmap passt
podman --versionNow ask Podman whether it is running rootless. Run this as your normal user, without sudo:
podman info --format '{{.Host.Security.Rootless}}'The first time any podman command runs as your user, it creates its storage under ~/.local/share/containers and its configuration under ~/.config/containers. Root's containers (anything you start with sudo podman) live in a completely separate store under /var/lib/containers, so podman ps and sudo podman ps show different lists.
On prepaid or metered data, keep in mind that each store pulls its own copy of every image. Pick one, rootless for day-to-day work, and stick to it.
Check it worked
podman --version prints podman version 5.7.0 (or a later 5.7 patch release), and the podman info command prints true. If it prints false, you ran it with sudo or as root; run it again as your own user.
Step 2 · Look at your subordinate ID ranges
A container image usually expects several users: root (0), and often a service user such as nginx (101). A rootless process owns only one host user ID, yours. To give the container a full set of IDs, Linux lets an administrator hand each user a block of extra "subordinate" IDs, listed in /etc/subuid and /etc/subgid. On Ubuntu, adduser gives each new user a block of 65,536 automatically.
See your entries:
grep "^$USER:" /etc/subuid /etc/subgidEach line reads name:start:count. Now look at the mapping Podman builds from it. podman unshare runs a command inside the same user namespace your containers use:
podman unshare cat /proc/self/uid_mapThe output has something like these two lines:
0 1000 1
1 100000 65536Read each line as "inside ID, host ID, how many". Inside the namespace, ID 0 (root) is your own host user (1000 here). IDs 1 to 65536 are your subordinate block, starting at host ID 100000. Nothing inside the container maps to the host's real root.
If either grep prints nothing, your user has no range. On current Ubuntu, useradd and adduser allocate one for normal users automatically, so this usually means a system user (made with useradd -r), an account from LDAP or SSSD, or one created by a tool that edits /etc/passwd directly. Add one, choosing a start that does not overlap other lines in the files, then tell Podman to pick it up:
sudo usermod --add-subuids 200000-265535 --add-subgids 200000-265535 "$USER"
podman system migrateCheck it worked
grep shows one line for your user in each file, and uid_map shows two lines: one mapping 0 to your own UID and one mapping 1 onwards to the start of your /etc/subuid range.
Step 3 · Use fully qualified image names
With Docker, nginx silently means docker.io/library/nginx. Podman does not assume Docker Hub. When you give it a short name, it looks the name up in /etc/containers/registries.conf and the files in /etc/containers/registries.conf.d/. Those files can list aliases (fixed short name to full name mappings), unqualified-search-registries (registries to try in order) and short-name-mode, which decides whether Podman asks you to choose, refuses, or picks for you.
See what your system is set to:
grep -rhE '^\s*(unqualified-search-registries|short-name-mode)' /etc/containers/registries.conf /etc/containers/registries.conf.d/ 2>/dev/nullSearch lists are a supply-chain risk. If two registries are listed and someone publishes an image with the same name on the first one, a short name can pull their image instead of the one you meant. A script that runs without a terminal cannot answer Podman's "which registry?" prompt either, so short names behave differently in CI from how they behave in your shell.
The fix is a habit, not a setting: always write the registry, the namespace and a tag.
podman pull docker.io/library/nginx:1.30-alpine
podman image lsDo the same in Containerfiles (FROM docker.io/library/alpine:3.23), compose files and Quadlet units, so the same name means the same image on every machine.
Check it worked
The pull finishes without asking you to pick a registry, and podman image ls lists docker.io/library/nginx with the tag 1.30-alpine. The grep output (which may be empty) tells you what a short name would have done on this machine.
Step 4 · Run a container and compare the commands with Docker
Start Nginx in the background as your user, publishing container port 80 on host port 8080:
podman run -d --name web -p 8080:80 docker.io/library/nginx:1.30-alpine
curl -s http://localhost:8080 | grep -o '<title>.*</title>'Day-to-day commands match Docker's closely. The main ones, with what is different:
podman run,podman ps,podman logs,podman exec,podman stop,podman rmtake the same common flags as theirdockerequivalents.podman pslists only your user's containers. There is no shared daemon, so another user's rootless containers are invisible to you, and root's are invisible withoutsudo.podman logs webreads the container's log, which is kept in your user journal or in a file depending on thelog_driversetting (journald is the usual default on Ubuntu with systemd). There is no daemon collecting them, andpodman logsshows them only while the container exists.--restart=alwaysdoes not bring a container back after a reboot on its own, because no daemon is running at boot to restart it. Use a systemd unit for that; the Quadlet tutorial in Next steps covers it.
Check the container and its logs:
podman ps
podman logs web | tail -n 3Now see the user namespace at work. podman top can show each process's user inside the container next to the host user it really runs as:
podman top web user huserCheck it worked
curl prints <title>Welcome to nginx!</title>. podman ps shows web with status Up and 0.0.0.0:8080->80/tcp. In the podman top output, the Nginx master process runs as root in the USER column and as your own user name in the HUSER column, and the worker processes run as nginx inside and as a number from your subordinate range (such as 100100) on the host.
Step 5 · Understand rootless networking and ports below 1024
A rootless user cannot create network interfaces on the host, so Podman hands that job to pasta (from the passt package), which has been the default since Podman 5.0. pasta gives the container a copy of the host's network address and translates its traffic in user space. Confirm the container is using it:
podman inspect web --format '{{.HostConfig.NetworkMode}}'Two effects of this are worth knowing:
- From inside the container,
localhostis the container, not your host. To reach a service on the host, use the namehost.containers.internal, which Podman adds to the container's/etc/hosts. - The older
slirp4netnstool still exists in Podman 5.7, but Podman 6 removed it. If you find a guide that passes--network slirp4netns, translate it to pasta.
Next, try to publish a low port:
podman run -d --name web80 -p 80:80 docker.io/library/nginx:1.30-alpineThis fails. The exact wording depends on the network mode; with the pasta default you will see something like Error: pasta failed with exit code 1: Failed to bind port 80 (Permission denied). Linux reserves ports below 1024 for root, and rootless Podman follows that rule. Clean up the failed container before you go on:
podman rm -f web80You have two sensible options:
- Keep containers on high ports such as 8080 and put a reverse proxy (Nginx or Caddy installed on the host) on 80 and 443 in front of them. This keeps the container fully unprivileged and is the usual choice on a server.
- Lower the start of the unprivileged range with a sysctl, for example a file
/etc/sysctl.d/99-unprivileged-ports.confcontainingnet.ipv4.ip_unprivileged_port_start=80, thensudo sysctl --system. Be aware that this lets every user and process on the machine bind port 80 and above, not only Podman, so do it only on a machine you alone use.
Check it worked
podman inspect prints pasta, the port-80 attempt fails with a pasta Failed to bind port 80 (Permission denied) error, and podman ps -a no longer lists web80.
Step 6 · Know where the Docker alias and podman compose fall short
Ubuntu offers a podman-docker package that installs a docker command which runs Podman. It helps with muscle memory and with simple scripts. Install it only if no real Docker Engine is on the machine, because both packages want to provide /usr/bin/docker:
sudo apt install -y podman-docker
docker psThe alias prints a short notice that it is emulating the Docker CLI with Podman (create the file /etc/containers/nodocker to silence it). Where it falls short:
- Tools that talk to the Docker API socket (
/var/run/docker.sock), such as some CI runners and IDE plugins, do not use thedockercommand at all. For those, start Podman's compatible API as your user withsystemctl --user enable --now podman.socketand point them at it withDOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock. - Behaviour tied to a daemon (restart at boot,
docker eventsfor containers started by other users, Swarm) has no direct equivalent. - Rootless limits still apply under the
dockername: low ports and per-user image stores behave as in the steps above.
For multi-container setups, podman compose is not a compose engine itself. It is a thin wrapper that runs an external provider: docker-compose if it finds one, otherwise podman-compose, a separate Python project packaged in Ubuntu as podman-compose (1.5 in 26.04). That project reads the same YAML but is not a line-for-line copy of Docker Compose, so newer or less common keys may be ignored or behave differently. Test your compose file under Podman before relying on it, and for long-running services on a server prefer Quadlet units, which systemd manages directly.
Check it worked
docker ps prints the notice followed by a list that includes web, the same container podman ps shows. If you already have Docker Engine installed, skip the install and confirm instead that docker ps there does not list web: the two tools keep separate containers.
Step 7 · Clean up
Remove the container and the image you pulled. These commands touch only the names used in this tutorial:
podman rm -f web
podman image rm docker.io/library/nginx:1.30-alpineIf you installed podman-docker only to try it, remove it too with sudo apt remove podman-docker.
Check it worked
podman ps -a no longer lists web, and podman image ls no longer lists docker.io/library/nginx.
Next steps
- If you need Docker Engine for a tool that only supports it, follow Install Docker Engine on Ubuntu 26.04.
Need this done for you?
Padding does this work for growing companies, from the first diagnosis to a system that keeps working.
Get new tutorials