Changes to the Exclude-option to only exclude exact matches.

This commit is contained in:
mag37 2023-06-21 20:09:31 +02:00
parent 0e2bdc94ad
commit a25e648557

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
VERSION="v0.2.3"
### ChangeNotes: Added self-updating git/curl-function and a dirty changenote.
VERSION="v0.2.4"
### ChangeNotes: Fixes to the Exclude-option to only exclude exact matches.
Github="https://github.com/mag37/dockcheck"
RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh"
@ -154,9 +154,17 @@ for i in "${GotUpdates[@]}"; do
done
}
### Listing typed exclusions:
if [[ -n ${Excludes[*]} ]] ; then
printf "\n\033[0;34mExcluding these names:\033[0m\n"
printf "%s\n" "${Excludes[@]}"
printf "\n"
fi
### Check the image-hash of every running container VS the registry
for i in $(docker ps --filter "name=$SearchName" --format '{{.Names}}') ; do
[[ " ${Excludes[*]} " =~ ${i} ]] && continue; # Skip if the container is excluded
### Looping every item over the list of excluded names and skipping:
for e in "${Excludes[@]}" ; do [[ "$i" == "$e" ]] && continue 2 ; done
printf ". "
RepoUrl=$(docker inspect "$i" --format='{{.Config.Image}}')
LocalHash=$(docker image inspect "$RepoUrl" --format '{{.RepoDigests}}')