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 #4826

Closed
mrname opened this issue May 15, 2017 · 4 comments
Closed

Restarting Unhealthy Containers #4826

mrname opened this issue May 15, 2017 · 4 comments

Comments

@mrname
Copy link

mrname commented May 15, 2017

I just want to make sure I am not missing anything in regards to how health checks and restart policies work together. It would seem that when a container is marked as "unhealthy" by a health check, there is no way to instruct compose to restart the container. This is because restart policies only take effect based on the exit code of the container itself.

Is there some way to instruct docker compose to restart an unhealthy container? If not, can anybody suggest an appropriate workaround?

Please note that I understand that orchestration tools like kubernetes can handle these situations. The use case here is for lightweight offline deployments using docker compose up -d, without the need for robust orchestration like kubernetes.

@shin-
Copy link

shin- commented May 15, 2017

That's more of a Docker Engine feature. Here is a good place to start.

@mrname
Copy link
Author

mrname commented May 16, 2017

Thanks for the quick response @shin-

@shin- shin- closed this as completed May 24, 2017
@lig
Copy link

lig commented Apr 24, 2019

@shin- so, basically you've pointed to a "there is no way to do it" answer and "we won't do it in Docker".

AFAIU, it is exactly the job for an orchestration tool and docker compose is kinda that thing.

I'd say this should be implemented in restart policy or somehow. Moreover, that was there in version 2 compose file in depends_on section.

@jtwebman
Copy link

jtwebman commented Dec 23, 2020

I don't think this should be in Docker (Moby) but it should probably be in docker-compose. I understand you want people to use swarm but swarm is not a solution for just running some integration tests or a local dev environment. We are using https://hub.docker.com/r/willfarrell/autoheal/ for now!

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

No branches or pull requests

4 participants