mirror of
https://github.com/mag37/dockcheck.git
synced 2026-04-17 18:07:46 +00:00
Added exclude-opt
Added options to allow for exclude option to be used
This commit is contained in:
12
dc_brief.sh
Normal file → Executable file
12
dc_brief.sh
Normal file → Executable file
@@ -2,9 +2,21 @@
|
|||||||
|
|
||||||
### If not in PATH, set full path. Else just "regctl"
|
### If not in PATH, set full path. Else just "regctl"
|
||||||
regbin="regctl"
|
regbin="regctl"
|
||||||
|
### options to allow exclude:
|
||||||
|
while getopts "e:" options; do
|
||||||
|
case "${options}" in
|
||||||
|
e) Exclude=${OPTARG} ;;
|
||||||
|
*) exit 0 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift "$((OPTIND-1))"
|
||||||
|
### Create array of excludes
|
||||||
|
IFS=',' read -r -a Excludes <<< "$Exclude" ; unset IFS
|
||||||
|
|
||||||
SearchName="$1"
|
SearchName="$1"
|
||||||
|
|
||||||
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
|
||||||
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}}')
|
||||||
|
|||||||
Reference in New Issue
Block a user