Restart "always" should restart unhealthy and running containers. #49161
Description
Description
Hey,
There are some cases that unhealthy containers keep running and would not exit with a non-zero status code.
According to the documentation:
Always restart the container if it stops. If it's manually stopped, it's restarted only when Docker daemon restarts or the container itself is manually restarted.
It is not obviously mentioned what would happen to running Unhealthy containers.
Scenario:
I have a Python Celery project run by command celery -A run.celery worker
. Celery keeps running when facing a connection timeout/loss or any failure and keeps retrying based on its configurations.
I have set the healthcheck command to celery -A run.celery inspect ping
, so it would be considered unhealthy when this command exists with a non-zero status code, meanwhile the worker is still running but coping with a failure.
The point is, restart policy "always" does not restart the containers when they are considered Unhealthy by healthcheck command.
We expect the restart policy 'always' to restart the container not just when it stops but also when it enters an unhealthy state as defined by the health check.
Activity