Skip to content

Commit a91f0f8

Browse files
authored
Improve jdk download retries (#48560)
* Addretries to the curl command Look like the `--retry` argument is not always affective. Closes #40531
1 parent 39b6d2f commit a91f0f8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

distribution/docker/src/docker/Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ FROM centos:7 AS builder
1616
ENV PATH /usr/share/elasticsearch/bin:$PATH
1717
ENV JAVA_HOME /opt/jdk-${jdkVersion}
1818

19-
RUN curl -L --retry 8 -s -S ${jdkUrl} --continue-at - --output /tmp/jdk.tar.gz && \
20-
tar -C /opt -zxf /tmp/jdk.tar.gz && \
21-
rm -Rf /tmp/jdk.tar.gz
22-
19+
RUN for iter in {1..10}; do curl -L -s -S ${jdkUrl} | tar -C /opt -zx && \
20+
exit_code=0 && break || exit_code=\$? && echo "download error: retry $iter in 10s" && sleep 10; done; \
21+
(exit $exit_code)
22+
2323
# Replace OpenJDK's built-in CA certificate keystore with the one from the OS
2424
# vendor. The latter is superior in several ways.
2525
# REF: https://github.com/elastic/elasticsearch-docker/issues/171
@@ -56,7 +56,7 @@ COPY --from=builder /opt/jdk-${jdkVersion} /opt/jdk-${jdkVersion}
5656

5757
RUN for iter in {1..10}; do yum update --setopt=tsflags=nodocs -y && \
5858
yum install -y --setopt=tsflags=nodocs nc unzip wget which && \
59-
yum clean all && exit_code=0 && break || exit_code=\$? && echo "yum error: retry \$iter in 10s" && sleep 10; done; \
59+
yum clean all && exit_code=0 && break || exit_code=\$? && echo "yum error: retry $iter in 10s" && sleep 10; done; \
6060
(exit $exit_code)
6161

6262
RUN groupadd -g 1000 elasticsearch && \

0 commit comments

Comments
 (0)