Container not stop when agent is stoppped


I have followed this guide to setup newrelic agent on Ubuntu Core. Everything is working fine. Except when there is a network issue, the newrelic agent is stopped but the container is still running. If the newrelic agent is stopped the container should terminate and start again.

Please see my logs. How do I get the docker container to restart when the newrelic agent stops?

time="2021-01-12T23:39:57Z" level=warning msg="URL error detected. May be a configuration problem or a network connectivity issue." component=AgentService error="Head \"\": dial tcp: lookup on [::1]:53: read udp [::1]:44844->[::1]:53: read: connection refused" service=newrelic-infra

time=“2021-01-12T23:39:57Z” level=error msg=“Can’t reach the New Relic collector.” component=AgentService error=“Head “”: dial tcp: lookup on [::1]:53: read udp [::1]:44844->[::1]:53: read: connection refused” service=newrelic-infra
time=“2021-01-12T23:39:57Z” level=info msg=“agent process exited, stopping agent service daemon…” exit_code=1
time=“2021-01-13T02:31:10Z” level=info msg=“service is stopping. waiting for agent process to terminate…”
[WARN tini (3602)] Tini is not running as PID 1 and isn’t registered as a child subreaper.
Zombie processes will not be re-parented to Tini, so zombie reaping won’t work.
To fix the problem, use the -s option or set the environment variable TINI_SUBREAPER to register Tini as a child subreaper, or run Tini as PID 1.