Is there a command to show the containers and images present in the server? That means for root and all the users (rootless containers)?
su -
podman container ps --all
shows only root's containers.
I expected root to be able to see all the other containers.
I don't think there is any command to list all containers for all users, but you could list all containers for an arbitrary user:
sudo systemd-run --machine=username@ --quiet --user --collect --pipe --wait podman container ps --all
(a recent version of systemd is needed for the command above).
You could also use machinectl
$ sudo -i
# machinectl shell username@
Connected to the local host. Press ^] three times within 1s to exit session.
$ podman container ps --all
Both executables belong to the systemd project.
$ rpm -qf /usr/bin/systemd-run
systemd-249.9-1.fc35.x86_64
$ rpm -qf /usr/bin/machinectl
systemd-container-249.9-1.fc35.x86_64
$ cat /etc/fedora-release
Fedora release 35 (Thirty Five)
As to why not use su
see
Quote Why can't I run rootless Podman containers when I log into a user via sudo or su? from https://www.redhat.com/sysadmin/sudo-rootless-podman