diff --git a/.ci/run-elasticsearch.sh b/.ci/run-elasticsearch.sh index a2424159..a586603d 100755 --- a/.ci/run-elasticsearch.sh +++ b/.ci/run-elasticsearch.sh @@ -157,6 +157,16 @@ fi echo -e "\033[34;1mINFO:\033[0m Starting container $NODE_NAME \033[0m" +# Pull the container, retry on failures up to 5 times with +# short delays between each attempt. Fixes most transient network errors. +docker_pull_attempts=0 +until [ "$docker_pull_attempts" -ge 5 ] +do + docker pull docker.elastic.co/elasticsearch/"$ELASTICSEARCH_VERSION" && break + docker_pull_attempts=$((docker_pull_attempts+1)) + sleep 10 +done + set -x docker run \ --name "$NODE_NAME" \