Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: auto-restart containers depend on restart unhealthly parent #49

Open
PiDroid-B opened this issue Jun 26, 2022 · 0 comments

Comments

@PiDroid-B
Copy link

PiDroid-B commented Jun 26, 2022

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.

@PiDroid-B PiDroid-B changed the title Feature request: auto-restart of containers contains depends_on when the parent container will be restart Feature request: auto-restart containers depend on restart unhealthly parent Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant