Added error check.
Added error check so that instead of breaking, if containers cant be checked on the registry (eg. locally built or deprecated) they'll be added to a error-list.
This commit is contained in:
11
dockcheck.sh
11
dockcheck.sh
@ -63,12 +63,17 @@ do
|
||||
printf ". "
|
||||
RepoUrl=$(docker inspect "$i" --format='{{.Config.Image}}')
|
||||
LocalHash=$(docker image inspect "$RepoUrl" --format '{{.RepoDigests}}' | sed -e 's/.*sha256/sha256/' -e 's/\]$//')
|
||||
RegHash=$($regbin image digest --list "$RepoUrl")
|
||||
RegHash=$($regbin image digest --list "$RepoUrl" 2>/dev/null)
|
||||
# Check if regtcl produces errors - add to GotErrors if so.
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [[ "$LocalHash" != "$RegHash" ]] ; then
|
||||
GotUpdates+=("$i")
|
||||
else
|
||||
NoUpdates+=("$i")
|
||||
fi
|
||||
else
|
||||
GotErrors+=("$i")
|
||||
fi
|
||||
done
|
||||
|
||||
### List what containers got updates or not
|
||||
@ -80,6 +85,10 @@ if [ -n "$GotUpdates" ] ; then
|
||||
printf "\n\033[31;1mContainers with updates available:\033[0m\n"
|
||||
printf "%s\n" "${GotUpdates[@]}"
|
||||
fi
|
||||
if [ -n "$GotErrors" ] ; then
|
||||
printf "\n\033[33;1mContainers with errors, wont get updated:\033[0m\n"
|
||||
printf "%s\n" "${GotErrors[@]}"
|
||||
fi
|
||||
|
||||
### Optionally get updates if there's any
|
||||
if [ -n "$GotUpdates" ] ; then
|
||||
|
Reference in New Issue
Block a user