I am using Docker version 17.09.0-ce
, and I see that containers are marked as unhealthy. Is there an option to get the container restart instead of keeping the cont
You can try put in your Dockerfile something like this:
HEALTHCHECK --interval=5s --timeout=2s CMD curl --fail http://localhost || kill 1
Don't forget --restart always
option.
kill 1
will kill process with pid 1 in container and force container exit. Usually the process started by CMD or ENTRYPOINT has pid 1.
Unfortunally, this method likely don't change container's state to unhealthy, so be careful with it.