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

Restarting Unhealthy Containers #6669

Closed
lig opened this issue Apr 24, 2019 · 6 comments
Closed

Restarting Unhealthy Containers #6669

lig opened this issue Apr 24, 2019 · 6 comments
Labels

Comments

@lig
Copy link

lig commented Apr 24, 2019

There was this one about 2 years ago on that topic #4826

It looks like Docker Compose is pointing to Docker and Docker is pointing to orchestration tools.

Is it possible to have restart policy to depend on health status? It looks like the job for Docker Compose for me.

Also, it was there for version 2 compose files in depends_on section.

@stale
Copy link

stale bot commented Oct 21, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 21, 2019
@stale
Copy link

stale bot commented Oct 28, 2019

This issue has been automatically closed because it had not recent activity during the stale period.

@stale stale bot closed this as completed Oct 28, 2019
@InsOpDe
Copy link

InsOpDe commented Dec 13, 2019

Please open again as it is still relevant

@pbelskiy
Copy link

When it will be able to?

@PhilippHomann
Copy link

PhilippHomann commented Apr 15, 2020

Imho there is no way to do this in compose, because compose is not running during runtime of a container or services (except you omit -d on up).
To monitor the health state of a container and do actions on change you need to have a daemon.
Implementing those actions into docker daemon looks much smarter to me.
moby/moby#28400

@t3chn0m4g3
Copy link

Dirty, but works fine if docker-compose uses restart=always:

STOPSIGNAL SIGINT
HEALTHCHECK CMD if [ $(ps -C mpv -p 1 -o %cpu | tail -n 1 | cut -f 1 -d ".") -gt 99 ]; then kill -2 1; else exit 0; fi
  • -p 1 Monitors PID 1 only and kills process if process CPU usage is > 99%.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants