Creating a systemd Service for a Podman Pod
To create a systemd service file for managing a Podman pod:
-
Generate the systemd unit file:
Use
podman generate systemdwith the--newflag to avoid generating a service for a currently running container. This ensures a create a new container out of the image:Warning
If you use the same name for both the pod and a container, only the container’s service will be generated. Make sure the pod and container names are unique if you want a pod-level service.
-
Move the generated service files to the user systemd directory
Move the
.servicefile(s) to the appropriate location in your user’s systemd configuration directory: -
Reload the systemd user daemon:
Inform systemd about the new unit file:
-
Enable and start the service:
Use
--nowto both enable the service at boot and start it immediately: