Created
November 15, 2024 04:47
-
-
Save nobiit/fdf73bfbc15d4396fb6e6cc7e46fe7d8 to your computer and use it in GitHub Desktop.
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 | |
| set -e | |
| touch /tmp/images-up-to-dated | |
| for item in $(docker service ls -q); do | |
| image=$(docker service inspect "${item}" | jq -r '.[].Spec.TaskTemplate.ContainerSpec.Image') | |
| if [ $(cat /tmp/images-up-to-dated | grep -wc "${image}") -gt 0 ]; then | |
| continue | |
| fi | |
| printf "${image} ... " | |
| if docker pull ${image} &>/dev/null; then | |
| echo "OK !" | |
| echo "${image}" | tee -a /tmp/images-up-to-dated >> /dev/null | |
| else | |
| echo "Failed :((" | |
| fi | |
| done | |
| echo OK |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment