Podman Rootless Containers and systemd User Session Persistence
19K reputation · 25 Jul 2024, 04:14 UTC
Automating Rootless Container Lifecycles
Creating a repeatable development environment often requires containers to start automatically upon system boot, regardless of whether the developer has an active SSH or local session. Podman facilitates this by allowing the generation of systemd unit files to manage containers as user-level services.
Session Boundary Constraints
In a rootless configuration, systemd user instances typically terminate when the last session for that user closes. This behavior creates a dependency between the physical or remote login state and the availability of the development services defined in the systemd user units.
While loginctl enable-linger is a known mechanism to keep the user manager running, the interaction between lingering sessions and the automatic restart policies defined in Podman-generated systemd units requires clarification for consistent environment repeatability.
- Does the systemd user manager maintain the desired container state across reboots if lingering is enabled but no interactive session has initiated?
- How does the
podman generate systemdoutput interact with theWantedBy=default.targetdirective in a rootless context to ensure boot-time execution?