aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-09-13 18:22:37 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-09-13 21:47:52 +0200
commita41f1b5c25c50f4d1c28dd38e212404210aee48e (patch)
tree05e8662d753c0b697d45f3b05950f10dc454a144
parent5756bd350d585660cce53a28dc66bfcf162ecca1 (diff)
Auto retrieve docker image tag
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
-rwxr-xr-xscripts/xds-docker-create-container.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/xds-docker-create-container.sh b/scripts/xds-docker-create-container.sh
index 52dfda3..0adc2d9 100755
--- a/scripts/xds-docker-create-container.sh
+++ b/scripts/xds-docker-create-container.sh
@@ -30,6 +30,16 @@ VERSION=4.0
DOCKER_USER=devel
DEFIMAGE=$REGISTRY/$REPO/$NAME-$FLAVOUR:$VERSION
+docker images |grep $DEFIMAGE 2>&1 > /dev/null
+if [ "$?" = "1" ]; then
+ VERSION=`docker images $REGISTRY/$REPO/$NAME-$FLAVOUR:* --format "{{.Tag}}"`
+ if [ "$VERSION" = "" ]; then
+ echo "ERROR: cannot automatically retrieve image tag for $REGISTRY/$REPO/$NAME-$FLAVOUR"
+ exit 1
+ fi
+ DEFIMAGE=$REGISTRY/$REPO/$NAME-$FLAVOUR:$VERSION
+fi
+
function usage() {
echo "Usage: $(basename $0) <instance ID> [image name]" >&2