Compose: Restarting Unhealthy Containers

Created on 15 May 2017  ·  3Comments  ·  Source: docker/compose

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.

kinquestion

Most helpful comment

@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.

All 3 comments

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

Thanks for the quick response @shin-

@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.

Was this page helpful?
0 / 5 - 0 ratings