Merge "Retry pulling and tagging image"
diff --git a/de/heat-templates/scripts/functions.sh b/de/heat-templates/scripts/functions.sh
index 4524075..b8b6969 100644
--- a/de/heat-templates/scripts/functions.sh
+++ b/de/heat-templates/scripts/functions.sh
@@ -327,6 +327,7 @@
             nerdctl --address  unix:///run/containerd/containerd.sock -n k8s.io pull $image
         fi
         docker pull ${image}
+        docker image inspect ${image}
     }
     retry 10 "Can't pool docker image $image" pull_image_retry
 }
@@ -338,14 +339,14 @@
 
     local image_prefix=${DOCKER_UCP_IMAGE%/*}
     for image in $(docker container run --rm --name ucp -v /var/run/docker.sock:/var/run/docker.sock ${DOCKER_UCP_IMAGE} images --list); do
-        pull_image "${image_prefix}/${image##*/}"
-        if [[ $KUBERNETES_CONTAINER_RUNTIME == "crio" ]]; then
-            function retry_nerdctl_tag {
-                nerdctl --address  unix:///run/containerd/containerd.sock -n k8s.io  tag ${image_prefix}/${image##*/} mirantis/${image##*/}
-            }
-            retry 10 "Failed to tag image" retry_nerdctl_tag
-        fi
-        docker tag ${image_prefix}/${image##*/} mirantis/${image##*/}
+        function _pull_and_tag {
+            pull_image "${image_prefix}/${image##*/}"
+            if [[ $KUBERNETES_CONTAINER_RUNTIME == "crio" ]]; then
+                nerdctl --address  unix:///run/containerd/containerd.sock -n k8s.io  tag ${image_prefix}/${image##*/} mirantis/${image##*/} || (docker image ls && /bin/false)
+            fi
+            docker tag ${image_prefix}/${image##*/} mirantis/${image##*/}
+        }
+        retry 10 "Failed to pull and tag image" _pull_and_tag
     done
 }