diff --git a/dc_function.sh b/dc_function.sh index da25b95..62ea6ad 100644 --- a/dc_function.sh +++ b/dc_function.sh @@ -14,9 +14,12 @@ 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") - if [[ "$LocalHash" != "$RegHash" ]] ; then printf "Updates available.\n" ; else printf "Already latest.\n" ; fi + for i in $(docker ps --filter "name=$1" --format '{{.Names}}') + do + RepoUrl=$(docker inspect $i --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 for $i.\n" ; else printf "$i is already latest.\n" ; fi + done fi }