Created
January 8, 2025 09:03
-
-
Save ivanrad/7898a0ddd1442defe51c8aabbc6d7b5d to your computer and use it in GitHub Desktop.
docker_outdated.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Display which currently running docker images are outdated | |
set -eu -o pipefail | |
docker ps --format '{{ .Image }}' | | |
while read -r image; do | |
cur_digest=$(docker image inspect --format '{{ index .RepoDigests 0 }}' "$image" | | |
cut -d'@' -f2-) | |
latest_digest=$(regctl image digest "$image") | |
if [[ $cur_digest != $latest_digest ]]; then | |
printf '%s: current=%s; latest=%s\n' "$image" "$cur_digest" "$latest_digest" | |
else | |
printf '%s: ok\n' "$image" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment