-
-
Save hongkongkiwi/feb24ed04e4b3c912bc86f565ef79b53 to your computer and use it in GitHub Desktop.
Check if newer docker image available.
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
#!/bin/bash | |
# ensure running bash | |
if ! [ -n "$BASH_VERSION" ];then | |
echo "this is not bash, calling self with bash...."; | |
SCRIPT=$(readlink -f "$0") | |
/bin/bash $SCRIPT | |
exit; | |
fi | |
REGISTRY="my.registry.com:5000" | |
REPOSITORY="awesome-project-of-awesomeness" | |
LATEST="`wget -qO- http://$REGISTRY/v1/repositories/$REPOSITORY/tags`" | |
LATEST=`echo $LATEST | sed "s/{//g" | sed "s/}//g" | sed "s/\"//g" | cut -d ' ' -f2` | |
RUNNING=`docker inspect "$REGISTRY/$REPOSITORY" | grep Id | sed "s/\"//g" | sed "s/,//g" | tr -s ' ' | cut -d ' ' -f3` | |
if [ "$RUNNING" == "$LATEST" ];then | |
echo "same, do nothing" | |
else | |
echo "update!" | |
echo "$RUNNING != $LATEST" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment