[hotfix] Align the parameter pattern of retry_times with retry_times_with_backoff_and_cleanup

This closes #10668.
diff --git a/flink-end-to-end-tests/test-scripts/common.sh b/flink-end-to-end-tests/test-scripts/common.sh
index 095875b..7b7e857 100644
--- a/flink-end-to-end-tests/test-scripts/common.sh
+++ b/flink-end-to-end-tests/test-scripts/common.sh
@@ -734,8 +734,7 @@
 }
 
 function retry_times() {
-    local command=${@:3}
-    retry_times_with_backoff_and_cleanup $1 $2 "$command" "true"
+    retry_times_with_backoff_and_cleanup $1 $2 "$3" "true"
 }
 
 function retry_times_with_backoff_and_cleanup() {
diff --git a/flink-end-to-end-tests/test-scripts/common_mesos_docker.sh b/flink-end-to-end-tests/test-scripts/common_mesos_docker.sh
index 08a72f7..5838809 100644
--- a/flink-end-to-end-tests/test-scripts/common_mesos_docker.sh
+++ b/flink-end-to-end-tests/test-scripts/common_mesos_docker.sh
@@ -39,6 +39,10 @@
 
 function start_flink_cluster_with_mesos() {
     echo "Starting Flink on Mesos cluster"
+    if ! retry_times $IMAGE_BUILD_RETRIES 0 build_image; then
+        echo "ERROR: Could not build mesos image. Aborting..."
+        exit 1
+    fi
     build_image
 
     docker-compose -f $END_TO_END_DIR/test-scripts/docker-mesos-cluster/docker-compose.yml up -d
@@ -60,12 +64,9 @@
 
 function build_image() {
     echo "Building Mesos Docker container"
-    if ! retry_times $IMAGE_BUILD_RETRIES 0 docker build -f $END_TO_END_DIR/test-scripts/docker-mesos-cluster/Dockerfile \
+    docker build -f $END_TO_END_DIR/test-scripts/docker-mesos-cluster/Dockerfile \
         -t flink/docker-mesos-cluster:latest \
-        $END_TO_END_DIR/test-scripts/docker-mesos-cluster/; then
-        echo "ERROR: Could not build mesos image. Aborting..."
-        exit 1
-    fi
+        $END_TO_END_DIR/test-scripts/docker-mesos-cluster/
 }
 
 function wait_job_terminal_state_mesos {
diff --git a/flink-end-to-end-tests/test-scripts/common_yarn_docker.sh b/flink-end-to-end-tests/test-scripts/common_yarn_docker.sh
index dcd28cc..42023fb 100755
--- a/flink-end-to-end-tests/test-scripts/common_yarn_docker.sh
+++ b/flink-end-to-end-tests/test-scripts/common_yarn_docker.sh
@@ -91,17 +91,17 @@
 
 function build_image() {
     echo "Building Hadoop Docker container"
-    if ! retry_times $IMAGE_BUILD_RETRIES 2 docker build --build-arg HADOOP_VERSION=2.8.4 \
+    docker build --build-arg HADOOP_VERSION=2.8.4 \
         -f $END_TO_END_DIR/test-scripts/docker-hadoop-secure-cluster/Dockerfile \
         -t flink/docker-hadoop-secure-cluster:latest \
-        $END_TO_END_DIR/test-scripts/docker-hadoop-secure-cluster/; then
-        echo "ERROR: Could not build hadoop image. Aborting..."
-        exit 1
-    fi
+        $END_TO_END_DIR/test-scripts/docker-hadoop-secure-cluster/
 }
 
 function start_hadoop_cluster_and_prepare_flink() {
-    build_image
+    if ! retry_times $IMAGE_BUILD_RETRIES 2 build_image; then
+        echo "ERROR: Could not build hadoop image. Aborting..."
+        exit 1
+    fi
     if ! retry_times $CLUSTER_SETUP_RETRIES 0 start_hadoop_cluster; then
         echo "ERROR: Could not start hadoop cluster. Aborting..."
         exit 1