Changes to the Exclude-option to only exclude exact matches.
This commit is contained in:
parent
0e2bdc94ad
commit
a25e648557
14
dockcheck.sh
14
dockcheck.sh
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
VERSION="v0.2.3"
|
VERSION="v0.2.4"
|
||||||
### ChangeNotes: Added self-updating git/curl-function and a dirty changenote.
|
### ChangeNotes: Fixes to the Exclude-option to only exclude exact matches.
|
||||||
Github="https://github.com/mag37/dockcheck"
|
Github="https://github.com/mag37/dockcheck"
|
||||||
RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh"
|
RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh"
|
||||||
|
|
||||||
@ -154,9 +154,17 @@ for i in "${GotUpdates[@]}"; do
|
|||||||
done
|
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
|
### Check the image-hash of every running container VS the registry
|
||||||
for i in $(docker ps --filter "name=$SearchName" --format '{{.Names}}') ; do
|
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 ". "
|
printf ". "
|
||||||
RepoUrl=$(docker inspect "$i" --format='{{.Config.Image}}')
|
RepoUrl=$(docker inspect "$i" --format='{{.Config.Image}}')
|
||||||
LocalHash=$(docker image inspect "$RepoUrl" --format '{{.RepoDigests}}')
|
LocalHash=$(docker image inspect "$RepoUrl" --format '{{.RepoDigests}}')
|
||||||
|
Loading…
Reference in New Issue
Block a user