On this page
- How does Podman differ from Docker?
- How do you install Podman on each distribution?
- What setup does a rootless user need?
- How do you run a container rootless?
- How do you write a Quadlet unit?
- How do you make rootless services start at boot?
- What about Ubuntu 22.04 and Debian 12 without Quadlet?
- How do you update images and use firewalls with Podman?
- Questions
How does Podman differ from Docker?
Podman runs containers without a central background daemon: each container is a child process started by the command that created it, and supervision is left to systemd. It runs fine as an ordinary user, so a compromised container gains at most that user rather than root. The command line mirrors Docker closely, so podman ps, podman exec and podman logs behave as you expect, and images from any OCI registry work. What you lose is the Docker daemon features some tools rely on, although Podman offers a compatible API socket for them. Choose one engine per server; running Docker and Podman side by side works but splits images and networks between them. If you want Docker after all, see the Docker Engine tutorial.
How do you install Podman on each distribution?
Podman is part of the standard repositories everywhere, so no extra repository is needed. On Rocky Linux 9 and AlmaLinux 9 it is the default container tool and comes from AppStream:
sudo dnf install podman
podman --versionOn Ubuntu and Debian install it from the main archive:
sudo apt update
sudo apt install podman
podman --versionVersions differ by release, which matters for Quadlet (it needs Podman 4.4 or newer). Ubuntu 24.04, Debian 13, Rocky Linux 9 and AlmaLinux 9 ship versions that include it. Ubuntu 22.04 (Podman 3.4) and Debian 12 (Podman 4.3) do not, so on those releases use podman generate systemd, described further down. Run podman info once to check that storage and networking initialise without errors.
What setup does a rootless user need?
Rootless containers map a range of user ids from the host into the container, defined in /etc/subuid and /etc/subgid. Accounts created with useradd or adduser on current releases get a range automatically; check, and add one if it is missing:
grep deploy /etc/subuid /etc/subgid
sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 deploy
podman system migrateLog in as deploy directly over SSH rather than switching with su or sudo -i, because the systemd user session and XDG_RUNTIME_DIR are only set up for real logins. If you must switch, use sudo machinectl shell deploy@. Creating the user itself is covered in the sudo user guide. Then confirm Podman runs rootless:
podman info --format '{{.Host.Security.Rootless}}'
podman run --rm docker.io/library/alpine:3.20 idThe first command prints true. Inside the container the process shows as root, yet on the host it is your unprivileged user.
How do you run a container rootless?
Use full image names such as docker.io/library/nginx:stable, since Podman may ask which registry you meant for short names. Ports below 1024 are reserved for root, so publish a high port and let a proxy handle 80 and 443:
mkdir -p ~/web/html
echo "served by podman" > ~/web/html/index.html
podman run -d --name web \
-p 127.0.0.1:8080:80 \
-v ~/web/html:/usr/share/nginx/html:ro,Z \
docker.io/library/nginx:stable
podman ps
curl http://127.0.0.1:8080The Z option relabels the folder for SELinux, which Rocky and Alma enforce; it does no harm on Ubuntu and Debian. Rootless images and volumes live under ~/.local/share/containers, separate from those of root and other users. If a public low port is truly required, lower the threshold with sudo sysctl -w net.ipv4.ip_unprivileged_port_start=80 and persist it in /etc/sysctl.d/.
How do you write a Quadlet unit?
Quadlet turns small declarative files into full systemd services. For a rootless user, place them in ~/.config/containers/systemd/; for system-wide containers running as root, use /etc/containers/systemd/. Remove the test container first with podman rm -f web, then create web.container:
mkdir -p ~/.config/containers/systemd
nano ~/.config/containers/systemd/web.container[Unit]
Description=Static site in nginx
[Container]
Image=docker.io/library/nginx:stable
ContainerName=web
PublishPort=127.0.0.1:8080:80
Volume=%h/web/html:/usr/share/nginx/html:ro,Z
AutoUpdate=registry
[Service]
Restart=always
[Install]
WantedBy=default.targetLoad and start it with the user instance of systemd. Quadlet units are generated, so there is no enable step; the [Install] section takes care of boot start:
systemctl --user daemon-reload
systemctl --user start web.service
systemctl --user status web.service --no-pager
journalctl --user -u web.service -n 20Quadlet also understands .volume, .network, .pod and .kube files, so a database and an app can share a network defined in a .network file. If a file has a typo, the service simply does not appear; run /usr/libexec/podman/quadlet -dryrun -user to see the parser errors.
How do you make rootless services start at boot?
User services normally stop when the user logs out and only start at the next login. Enable lingering so the user manager starts at boot and keeps running:
sudo loginctl enable-linger deploy
loginctl show-user deploy --property=LingerReboot once with sudo systemctl reboot and check with curl http://127.0.0.1:8080 after logging back in. More about unit files and boot order is in the systemd services guide.
What about Ubuntu 22.04 and Debian 12 without Quadlet?
Older Podman versions generate a unit file from an existing container instead. The command is deprecated in newer releases but still available where Quadlet is missing:
podman run -d --name web -p 127.0.0.1:8080:80 docker.io/library/nginx:stable
mkdir -p ~/.config/systemd/user
podman generate systemd --new --name web --files
mv container-web.service ~/.config/systemd/user/
podman rm -f web
systemctl --user daemon-reload
systemctl --user enable --now container-web.serviceThe --new flag makes the service create a fresh container on each start, so stale state does not build up. When you later upgrade to a newer release, move to Quadlet files.
How do you update images and use firewalls with Podman?
With AutoUpdate=registry in a Quadlet file, the bundled timer can pull newer images for the same tag and restart the service. Try it as a dry run first, then enable the timer for your user:
podman auto-update --dry-run
systemctl --user enable --now podman-auto-update.timerUse it only with tags you trust to stay compatible. For firewalls, rootless published ports are opened by a user-space helper process that listens on the host like any other program, so normal ufw or firewalld rules apply to them. Containers run as root with bridge networking add their own forwarding rules, much like Docker, so binding to 127.0.0.1 remains a good habit. Firewall setup is in the firewalld guide and the ufw guide.
Plans that fit this guide
Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.
Questions about Podman and rootless containers
Can Podman run my Compose files?
Yes, through podman compose, which calls an installed compose provider such as podman-compose (in the Ubuntu and Debian archives, and in EPEL for Rocky and Alma) or the Docker Compose plugin. The podman compose subcommand needs Podman 4.7 or newer; on older releases call podman-compose directly. For long-term services, Quadlet files integrate better with systemd.
Is there a docker command alias?
The podman-docker package adds a docker wrapper that calls Podman, which helps scripts written for Docker. Do not install it next to the real Docker Engine.
Where are rootless images stored?
In ~/.local/share/containers/storage of each user. Root containers use /var/lib/containers. Clean up with podman system prune as that user.
Why do rootless containers stop when I log out?
Lingering is off. Run sudo loginctl enable-linger USER so the user manager keeps running without a login session.
Does Podman need SELinux changes on Rocky and Alma?
No policy changes are needed. Add :Z or :z to bind mounts so the files get the right label, and SELinux keeps protecting the host.
More in Containers and PaaS
- Docker Compose stacks
- Docker volumes and bind mounts
- Read and limit Docker logs
- Free disk space used by Docker
- Build, tag and push Docker images
- Run and manage containers
- Docker Swarm across servers
- Automatic updates with Watchtower
- Portainer CE web UI
- Dokploy self-hosted PaaS
- CapRover PaaS
- Dokku git push deploys
- Coolify on your own server