there were two ways I used to do this with docker and it can also be done
with podman

1. stateless way, always fresh

ExecStartPre=-/bin/podman stop -t=1 mycnt
ExecStartPre=-/bin/podman remove mycnt
ExecStart=/bin/podman run -i --name mycnt -v .... myimg mycmd
ExecReload=-/bin/podman restart -t=1 mycnt
ExecStop=/bin/podman stop -t=1 mycnt

2. create once, and just attach

ExecStartPre=-/bin/podman run -d -w /etc/ -p 9090:8080 --name mycnt busybox
httpd -f -p 8080
ExecStartPre=-/bin/podman start mycnt
ExecStart=/bin/podman attach --no-stdin --sig-proxy mycnt
ExecReload=-/bin/podman restart -t=1 mycnt
ExecStop=/bin/podman stop -t=1 mycnt




On Mon, May 6, 2019 at 2:16 PM Farkas Levente <lfar...@lfarkas.org> wrote:

> On 5/2/19 9:20 PM, Brent Baude wrote:
> > On Thu, 2019-05-02 at 16:12 +0200, Farkas Levente wrote:
> >> - Create a systemd service file on the host for the healthcheck,
> >> - Create a systemd timer  file on the host for the healthcheck.
> >>
> >
> > Just for the record, healthchecks are optional.  The systemd service
> > and timer files are created automatically for you with podman and are
> > considered to be transient in nature.  That means if the system is
> > rebooted, that timer and service are deleted.  If the container is
> > started again, they are recreated.
>
> does it means the recommended way to create one systemd service file for
> the container and in this service the ExecStart's podman should have to
> be a --healthcheck-command parameter (and may be more) and use the
> podman generated transient timer or service for healtcheck?
>
> and in this case in case of failure who and how will restart the main
> service?
>
> --
>   Levente                               "Si vis pacem para bellum!"
>
>

Reply via email to