mirror of
https://github.com/mag37/dockcheck.git
synced 2026-04-19 10:57:45 +00:00
Update dc_function.sh
Added the possibility to check multiple containers by name-wildcarding. Eg `dockcheck ng` would check all containers named anything with `ng` like nginx_local, reverse_nginx
This commit is contained in:
@@ -14,9 +14,12 @@ dockcheck () {
|
|||||||
echo "No container name given, here's the list of currently running containers:"
|
echo "No container name given, here's the list of currently running containers:"
|
||||||
docker ps --format '{{.Names}}'
|
docker ps --format '{{.Names}}'
|
||||||
else
|
else
|
||||||
RepoUrl=$(docker inspect "$1" --format='{{.Config.Image}}')
|
for i in $(docker ps --filter "name=$1" --format '{{.Names}}')
|
||||||
LocalHash=$(docker image inspect "$RepoUrl" --format '{{.RepoDigests}}' | sed -e 's/.*sha256/sha256/' -e 's/\]$//')
|
do
|
||||||
RegHash=$(regctl image digest --list "$RepoUrl")
|
RepoUrl=$(docker inspect $i --format='{{.Config.Image}}')
|
||||||
if [[ "$LocalHash" != "$RegHash" ]] ; then printf "Updates available.\n" ; else printf "Already latest.\n" ; fi
|
LocalHash=$(docker image inspect $RepoUrl --format '{{.RepoDigests}}' | sed -e 's/.*sha256/sha256/' -e 's/\]$//')
|
||||||
|
RegHash=$(regctl image digest --list $RepoUrl)
|
||||||
|
if [[ "$LocalHash" != "$RegHash" ]] ; then printf "Updates available for $i.\n" ; else printf "$i is already latest.\n" ; fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user