Podman

Images

PLease check also https://www.tmade.de/wiki/doku.php?id=docker:docker and replace docker with podman!

podman images
podman rmi $(podman images -q) -f 

Commands

podman system reset               #system reset

Podman Desktop

https://podman-desktop.io/docs/installation/linux-install

sudo apt install flatpak podman
flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install --user flathub io.podman_desktop.PodmanDesktop
flatpak update --user io.podman_desktop.PodmanDesktop
flatpak uninstall io.podman_desktop.PodmanDesktop
flatpak uninstall --unused
flatpak run io.podman_desktop.PodmanDesktop

Container

podman run -itd mycontainer:latest bash             #deploy container "mycontainer" with tag "latest" in daemon-mode
podman container ls                                 #show running containers
podman container ls -a                              #check status of all containers (Up and Exited)
podman ps                                           #show running containers
podman exec -it 0d029837451d bash                   #enter bash in running container

Quadlet

Quadlets replace docker-compose/ podman-compose and use systemd.

https://www.redhat.com/en/blog/quadlet-podman

https://giacomo.coletto.io/blog/podman-quadlets/

Example “$HOME/.config/containers/systemd/mytest.container”:

[Unit]
Description=The sleep container
After=local-fs.target

[Container]
ContainerName=mytest
Image=registry.access.redhat.com/ubi9-minimal:latest
#AutoUpdate=registry
Exec=sleep 1000
#Exec=/bin/sh -c 'while true; do sleep 30; done'
#Network=my.network
HostName=mytest
PublishPort=8080:8080
Environment=VERSION="1.0"
Environment=LOGLEVEL="info"

#HealthCmd=curl http://127.0.0.1:8080
#UserNS=keep-id:uid=1000,gid=1000
#Volume=%h/containers/storage/uptime-kuma:/app/data

[Service]
Restart=always
TimeoutStartSec=300

[Install]
# Start by default on boot
WantedBy=multi-user.target default.target

Use and check:

systemctl --user daemon-reload              #non-root-user
systemctl daemon-reload                     #running under root
/usr/libexec/podman/quadlet -dryrun -user   #non-root-user
/usr/libexec/podman/quadlet -dryrun         #running under root

Storage

Set “runroot” for non-root-user (runRoot should always be mapped to a tmpfs file system - non-persistent storage that will be erased upon every reboot of host):

~/.config/containers/storage.conf
[storage]
runroot = "/run/user/$UID/run"
driver = "overlay"                              #if xfs-filesystem is underlaying

root-user:

/etc/containers/storage.conf
[storage]
runroot = "/run/user/$UID/run"
driver = "overlay"                              #if xfs-filesystem is underlaying

Check:

podman info | grep runRoot
runRoot: /run/user/10000/run
podman info --format '{{ .Store.GraphDriverName }}'
overlay
or
podman info | grep -i GraphDriver
graphDriverName: overlay

Remove old data for internal database:

rm -rf ~/.local/share/containers/             #non-root user
rm -rf /var/lib/containers                    #root

User setup

Running once

loginctl enable-linger podman

Inside target user (such as “su - podman”):

mkdir ~/.bashrc.d
echo "export XDG_RUNTIME_DIR=/run/user/\$UID/" > ~/.bashrc.d/systemd

This variable makes the use of

systemctl --user daemon-reload
systemctl --user status myservice.service

available.

docker/podman.txt · Last modified: by tmade
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki