Skip to content

Instantly share code, notes, and snippets.

@nobiit
Created November 15, 2024 04:47
Show Gist options
  • Select an option

  • Save nobiit/fdf73bfbc15d4396fb6e6cc7e46fe7d8 to your computer and use it in GitHub Desktop.

Select an option

Save nobiit/fdf73bfbc15d4396fb6e6cc7e46fe7d8 to your computer and use it in GitHub Desktop.
#! /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