deunhealth
deunhealth copied to clipboard
Feature request: auto-restart containers depend on restart unhealthly parent
context
When we have containers (aka childs) depending on another container (parent), the childs doesn't restart when the parent is failing and restarts.
services:
parent_container:
labels:
- deunhealth.restart.on.unhealthy=true
[...]
child1:
depends_on:
parent_container:
condition: service_healthy
network_mode: "service:parent_container"
labels:
- deunhealth.restart.on.unhealthy=true
[...]
child2:
depends_on:
parent_container:
condition: service_healthy
network_mode: "service:parent_container"
labels:
- deunhealth.restart.on.unhealthy=true
[...]
What's the feature? 🧐
- Add a solution to check childs when a restart of the parent is required and restart them when parent is "running" and/or "healthly".
Suggested solution
Maybe something like that :
add a label for child : deunhealth.restart.on.depends_on=true (maybe change "true" to the parent's container_name)
workflow of auto-restart parent :
- restart the container (parent)
- get list of other containers contains the according label (childs)
- if state is not running/healthly then restart it
Thank's for your help.