Podman Systemd

Docker uses a server-client model, and the server acts as the process supervisor over all containers. This includes starting them upon boot.

podman(1) instead runs like a conventional service. In order to daemonize a podman(1) container, users should look to systemd(1).


Services

podman(1) offers an interface for automatically generating a unit file.

podman generate systemd --new --name my-container > /etc/systemd/system/my-container.service

Then start and enable my-container.service.


Pods

Similarly, podman(1) offers an interface for generating the set of unit files required for a pod. The locations of the files will be printed to the screen after running.

$ podman generate systemd --new --files --name my-pod
/home/somebody/.config/systemd/user/pod-my-pod.service
/home/somebody/.config/systemd/user/container-my-container.service

These unit files are written as dependencies, to ensure that they are stopped and restarted as required.

The unit files are, however, installed as user services. If they should instead be installed to system services, further scripting will be necessary.


CategoryRicottone

Podman/Systemd (last edited 2023-04-06 15:43:06 by DominicRicottone)