On 6/4/21 17:30, Hendrik Haddorp wrote:
Hi,

I have a process (A) that starts a podman container as a child process
(B). When A dies due to a crash or gets killed I want the container to
be killed as well. I tried to start B with all kinds of process
attributes, like Setsid = true, Setpgid = true, Pdeathsig = SIGKILL, but
B does not get killed and the container runs on. In fact I see that the
podman process B has another child process and B seems to get reparented
to a "systemd --user" process when A dies.

How can I make sure the podman container dies when the parent process dies?
This is on Linux and rootless.

thanks,
Hendrik
_______________________________________________
Podman mailing list -- podman@lists.podman.io
To unsubscribe send an email to podman-leave@lists.podman.io

You could trap the exit code and cause it to send a stop signal to podman.


trap "podman stop --timeout 0 CTRID" EXIT