mirror of
https://github.com/mag37/dockcheck.git
synced 2026-02-15 07:48:14 +01:00
Update dockcheck_function.sh
safer code, encapsulation etc
This commit is contained in:
parent
9efbca8bb1
commit
0f14b123ef
1 changed files with 3 additions and 3 deletions
|
|
@ -9,9 +9,9 @@ dockcheck () {
|
|||
echo "No container name given, here's the list of currently running containers:"
|
||||
docker ps --format '{{.Names}}'
|
||||
else
|
||||
RepoUrl=$(docker inspect $1 --format='{{.Config.Image}}')
|
||||
LocalHash=$(docker image inspect $RepoUrl --format '{{.RepoDigests}}' | sed -e 's/.*sha256/sha256/' -e 's/\]$//')
|
||||
RegHash=$(regctl image digest --list $RepoUrl)
|
||||
RepoUrl=$(docker inspect "$1" --format='{{.Config.Image}}')
|
||||
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.\n" ; else printf "Already latest.\n" ; fi
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue