This is a systemd unit file for running a podman container as a systemd service.
For rootless containers, you can use systemd user units (More info)
Broken down, it does the following:
ExecStartPre
pulls the image. If you use the :latest
tag, then every time you start this service it'll pull the latest version
ExecStart
runs the container. It's important to use a container name, since it's referenced elsewhere. Don't detact the container (I.E. don't include -d
)
ExecStopPost
after the container is stopped, it'll remove the container (if it is still present), and remove the image. Removing the image is useful if you're using the :latest
image tag.