From df516ae123f59c0911691e57dd47c3bd14044854 Mon Sep 17 00:00:00 2001 From: Alpar Torok Date: Mon, 28 Oct 2019 05:31:02 +0200 Subject: [PATCH 1/3] Addretries to the curl command Look like the `--retry` argument is not always affective. Closes #40531 --- distribution/docker/src/docker/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/distribution/docker/src/docker/Dockerfile b/distribution/docker/src/docker/Dockerfile index 6ff48693cfd26..8d1cbc8ad2fbc 100644 --- a/distribution/docker/src/docker/Dockerfile +++ b/distribution/docker/src/docker/Dockerfile @@ -16,9 +16,9 @@ FROM centos:7 AS builder ENV PATH /usr/share/elasticsearch/bin:$PATH ENV JAVA_HOME /opt/jdk-${jdkVersion} -RUN curl -L --retry 8 -s -S ${jdkUrl} --continue-at - --output /tmp/jdk.tar.gz && \ - tar -C /opt -zxf /tmp/jdk.tar.gz && \ - rm -Rf /tmp/jdk.tar.gz +RUN for iter in {1..10}; do curl -L -s -S ${jdkUrl} | tar -C /opt -zx &&\ + exit_code=0 && break || exit_code=\$? && echo "download error: retry \$iter in 10s" && sleep 10; done; + # Replace OpenJDK's built-in CA certificate keystore with the one from the OS # vendor. The latter is superior in several ways. From c687b4d9a2e313d10dce38c3af2e29e4bfb1951f Mon Sep 17 00:00:00 2001 From: Alpar Torok Date: Wed, 30 Oct 2019 09:55:23 +0200 Subject: [PATCH 2/3] Pr review --- distribution/docker/src/docker/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/distribution/docker/src/docker/Dockerfile b/distribution/docker/src/docker/Dockerfile index 8d1cbc8ad2fbc..a2f5efbe004d1 100644 --- a/distribution/docker/src/docker/Dockerfile +++ b/distribution/docker/src/docker/Dockerfile @@ -16,10 +16,10 @@ FROM centos:7 AS builder ENV PATH /usr/share/elasticsearch/bin:$PATH ENV JAVA_HOME /opt/jdk-${jdkVersion} -RUN for iter in {1..10}; do curl -L -s -S ${jdkUrl} | tar -C /opt -zx &&\ - exit_code=0 && break || exit_code=\$? && echo "download error: retry \$iter in 10s" && sleep 10; done; +RUN for iter in {1..10}; do curl -L -s -S ${jdkUrl} | tar -C /opt -zx && \ + exit_code=0 && break || exit_code=\$? && echo "download error: retry $iter in 10s" && sleep 10; done; \ + (exit $exit_code) - # Replace OpenJDK's built-in CA certificate keystore with the one from the OS # vendor. The latter is superior in several ways. # REF: https://github.com/elastic/elasticsearch-docker/issues/171 @@ -56,7 +56,7 @@ COPY --from=builder /opt/jdk-${jdkVersion} /opt/jdk-${jdkVersion} RUN for iter in {1..10}; do yum update --setopt=tsflags=nodocs -y && \ yum install -y --setopt=tsflags=nodocs nc unzip wget which && \ - yum clean all && exit_code=0 && break || exit_code=\$? && echo "yum error: retry \$iter in 10s" && sleep 10; done; \ + yum clean all && exit_code=0 && break || exit_code=\$? && echo "yum error: retry $iter in 10s" && sleep 10; done; \ (exit $exit_code) RUN groupadd -g 1000 elasticsearch && \ From 67c20a741c45f981afb3da2340214c05dc3dcc31 Mon Sep 17 00:00:00 2001 From: Alpar Torok Date: Sun, 3 Nov 2019 05:06:55 +0200 Subject: [PATCH 3/3] remove whitespace --- distribution/docker/src/docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distribution/docker/src/docker/Dockerfile b/distribution/docker/src/docker/Dockerfile index a2f5efbe004d1..e4f583d54bbb2 100644 --- a/distribution/docker/src/docker/Dockerfile +++ b/distribution/docker/src/docker/Dockerfile @@ -19,7 +19,7 @@ ENV JAVA_HOME /opt/jdk-${jdkVersion} RUN for iter in {1..10}; do curl -L -s -S ${jdkUrl} | tar -C /opt -zx && \ exit_code=0 && break || exit_code=\$? && echo "download error: retry $iter in 10s" && sleep 10; done; \ (exit $exit_code) - + # Replace OpenJDK's built-in CA certificate keystore with the one from the OS # vendor. The latter is superior in several ways. # REF: https://github.com/elastic/elasticsearch-docker/issues/171