2022-12-25 13:40:38 +01:00
|
|
|
#!/bin/sh
|
2023-03-28 11:46:05 +02:00
|
|
|
docker_ps_grep_unhealthy="$(docker ps --filter health=unhealthy --format '{{.Names}}')"
|
|
|
|
docker_ps_grep_exited="$(docker ps --filter status=exited --format '{{.Names}}')"
|
2023-01-09 16:51:19 +01:00
|
|
|
exitcode=0
|
|
|
|
if [ ! -z "$docker_ps_grep_unhealthy" ]
|
2022-12-25 13:40:38 +01:00
|
|
|
then
|
|
|
|
echo "Some docker containers are unhealthy: $docker_ps_grep_unhealthy"
|
2023-01-09 16:51:19 +01:00
|
|
|
exitcode=1
|
|
|
|
fi
|
|
|
|
if [ ! -z "$docker_ps_grep_exited" ]
|
|
|
|
then
|
|
|
|
echo "Some docker containers exited: $docker_ps_grep_exited"
|
|
|
|
exitcode=2
|
|
|
|
fi
|
|
|
|
if [ "$exitcode" -ne "0" ]
|
|
|
|
then
|
|
|
|
exit $exitcode
|
|
|
|
fi
|
|
|
|
echo "All docker containers are healthy."
|
|
|
|
exit
|