Fix: piped execution of script failed
[src/xds/xds-server.git] / scripts / xds-docker-create-container.sh
index 644df35..706a6a4 100755 (executable)
@@ -93,23 +93,24 @@ done
 # Dynamically retrieve image name
 if [ "$IMAGE" = "" ]; then
 
-    IMAGES_LIST=$(docker images $REGISTRY/$REPO/$NAME-$FLAVOUR:* --format '{{.Tag}}')
-    VER_NUM=$(echo "$IMAGES_LIST" | wc -l)
+    VERSION_LIST=$(docker images $REGISTRY/$REPO/$NAME-$FLAVOUR --format '{{.Tag}}')
+    VER_NUM=$(echo "$VERSION_LIST" | wc -l)
     if [ $VER_NUM -gt 1 ]; then
-        echo "ERROR: more than one xds image found, please set explicitly the image to use ! List of found images:"
-        echo "$IMAGES_LIST"
+        echo "ERROR: more than one xds image found, please set explicitly the image to use !"
+        echo "List of found images:"
+        echo "$VERSION_LIST"
         exit 1
     elif [ $VER_NUM -lt 1 ]; then
         echo "ERROR: cannot automatically retrieve image tag for $REGISTRY/$REPO/$NAME-$FLAVOUR"
         exit 1
     fi
-    if [ "$IMAGES_LIST" = "" ]; then
+    if [ "$VERSION_LIST" = "" ]; then
         echo "ERROR: cannot automatically retrieve image tag for $REGISTRY/$REPO/$NAME-$FLAVOUR"
         usage
         exit 1
     fi
 
-    IMAGE=$REGISTRY/$REPO/$NAME-$FLAVOUR:$VERSION
+    IMAGE=$REGISTRY/$REPO/$NAME-$FLAVOUR:$VERSION_LIST
 fi
 
 USER=$(id -un)
@@ -224,7 +225,7 @@ if ($UPDATE_UID); then
     echo -n "."
     docker exec -t ${NAME} bash -c "systemctl start autologin"
     echo -n "."
-    ssh -p $SSH_PORT $DOCKER_USER@localhost -- "systemctl --user start xds-server" || exit 1
+    ssh -p $SSH_PORT $DOCKER_USER@localhost "systemctl --user start xds-server" || exit 1
     echo "."
     docker restart ${NAME}
 fi