Restarting an unhealthy docker container based on healthcheck

Restarting of unhealty container feature was in the original PR (https://github.com/moby/moby/pull/22719), but was removed after a discussion and considered to be done later as enhancement of RestartPolicy. At this moment you can use this workaround to automatically restarting unhealty containers: https://hub.docker.com/r/willfarrell/autoheal/ Here is a sample compose file: version: ‘2’ services: autoheal: restart: always image: willfarrell/autoheal … Read more

How to view docker-compose healthcheck logs?

You can use: docker inspect –format “{{json .State.Health }}” <container name> | jq Output: { “Status”: “unhealthy”, “FailingStreak”: 63, “Log”: [ { “Start”: “2017-03-11T20:49:19.668895201+03:30”, “End”: “2017-03-11T20:49:19.735722044+03:30”, “ExitCode”: 1, “Output”: “ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the … Read more