How about some low tech?
'A' start with nohup a watchdog script 'B' and A's pid as parameter
'B' starts the container 'C' and waits until the pid of 'A'
vanishes,
then it kills 'C' and terminates.
Am 07.06.21 um 15:37 schrieb Hendrik Haddorp:
> yeah, that's what I switch to now but as you can not trap SIGKILL this
> does not cover the case A gets killed that way.
>
> On 6/7/21 3:18 PM, Daniel Walsh wrote:
>> 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(a)lists.podman.io
>>> To unsubscribe send an email to podman-leave(a)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
>>
>> _______________________________________________
>> Podman mailing list -- podman(a)lists.podman.io
>> To unsubscribe send an email to podman-leave(a)lists.podman.io
>
>
> _______________________________________________
> Podman mailing list -- podman(a)lists.podman.io
> To unsubscribe send an email to podman-leave(a)lists.podman.io
>