From f7c4bf6ac5cb0def425904b6d9dc9a5a872ca479 Mon Sep 17 00:00:00 2001 From: Martin Lablans Date: Thu, 6 Oct 2022 12:49:31 +0200 Subject: [PATCH] Consider stopped docker containers for reports, updates --- lib/monitoring.sh | 2 +- lib/update-bridgehead.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/monitoring.sh b/lib/monitoring.sh index b6384b0..bdd9a35 100755 --- a/lib/monitoring.sh +++ b/lib/monitoring.sh @@ -29,7 +29,7 @@ function hc_send(){ fi if [ -z "$UPTIME" ]; then - UPTIME=$(docker ps --format 'table {{.Names}} \t{{.RunningFor}} \t {{.Status}} \t {{.Image}}' --filter name=bridgehead || echo "Unable to get docker statistics") + UPTIME=$(docker ps -a --format 'table {{.Names}} \t{{.RunningFor}} \t {{.Status}} \t {{.Image}}' --filter name=bridgehead || echo "Unable to get docker statistics") fi if [ -n "$2" ]; then diff --git a/lib/update-bridgehead.sh b/lib/update-bridgehead.sh index a79fece..19dd8e7 100755 --- a/lib/update-bridgehead.sh +++ b/lib/update-bridgehead.sh @@ -60,7 +60,7 @@ done # Check docker updates log "INFO" "Checking for updates to running docker images ..." docker_updated="false" -for IMAGE in $(docker ps --filter "name=bridgehead" --format {{.Image}}); do +for IMAGE in $(cat $PROJECT/docker-compose.yml | grep "image:" | sed -e 's_^.*image: \(.*\).*$_\1_g; s_\"__g'); do log "INFO" "Checking for Updates of Image: $IMAGE" if docker pull $IMAGE | grep "Downloaded newer image"; then log "INFO" "$IMAGE updated."