Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
$ als gewone gebruiker# als root (of met sudo)
The quick answer
Step by step
- Check rootless is ready — each user needs subordinate ID ranges:
grep "^$USER:" /etc/subuid /etc/subgid
/etc/subuid:alice:100000:65536
/etc/subgid:alice:100000:65536
podman info --format '{{.Host.Security.Rootless}}'
trueNew users get the ranges automatically; for old users: usermod --add-subuids 100000-165535 --add-subgids 100000-165535 alice.
- Same commands as Docker —
podman run/ps/logs/exec/build/push. Use full image names (docker.io/library/nginx) to avoid the "which registry?" prompt. - Ports below 1024 are for root only — use high ports (8080) and a proxy/firewall redirect in front, or (system-wide decision) lower
net.ipv4.ip_unprivileged_port_start. - Volumes and SELinux — add
:Zfor a private label (or:zshared), else SELinux denies access:
mkdir -p ~/site && echo hello > ~/site/index.html
podman run -d --name site -p 8081:80 -v ~/site:/usr/share/nginx/html:Z docker.io/library/nginx:1.27Files written by the container belong to sub-IDs on the host — use podman unshare chown to fix owners inside the user namespace.
- Pods and Compose:
podman podgroups containers like a Kubernetes Pod;podman kube play app.yamlruns Kubernetes YAML;podman compose(ordocker composewith the Podman socket) runs Compose files. - Keep containers running after logout — rootless containers stop when the user's session ends unless lingering is on:
loginctl enable-linger aliceFor real services use Quadlet (next how-to).
Check that it worked
podman info says rootless true, the container answers on its port, and ps -o user,cmd -C nginx on the host shows your user (or a sub-ID), not root.
Common problems
| Problem | Cause | Fix |
|---|---|---|
cannot find UID/GID for user / newuidmap errors | No subuid/subgid ranges. | Add ranges with usermod --add-subuids/--add-subgids; podman system migrate. |
rootlessport cannot expose privileged port 80 | Ports < 1024 need root. | Use 8080+; redirect in the firewall or a proxy. |
Permission denied on a mounted folder | SELinux label missing. | :Z or :z on the volume. |
| Containers stop after logout | No linger. | loginctl enable-linger USER, or Quadlet with linger. |
short-name resolution enforced prompt | Image without a registry. | Use full names (docker.io/…, quay.io/…). |
Scripts call docker | Muscle memory / tools. | podman-docker package (alias), or update the scripts. |
Go further
- Command pages: podman, loginctl.
- Next how-tos: Run a container as a systemd service, Run a container and publish a port, Find and fix SELinux denials.
- Full guide: Podman. Learn it: RH134 — Containers, Images with Podman in DevOps.
- Practise: Lab: run a rootless web container as a systemd service.
1Why is rootless Podman safer than Docker with the docker group?
Containers run as your normal user (mapped sub-IDs); a breakout does not give root on the host.
2Why can a rootless container not publish port 80?
Ports below 1024 are privileged; use a higher port and a proxy or firewall redirect.