From b1ab01823c14a34e84c5c0aa8bbafd23ae96b487 Mon Sep 17 00:00:00 2001 From: Arnaud RICHARD Date: Tue, 15 Jul 2025 17:06:36 +0200 Subject: [PATCH 1/3] Proxy-friendly version of install-docker-repository Previously the script would not work in some complex proxy environment. With this change, it is possible to have proxy set in http_proxy environment variable. --- scripts/ubuntu/1.1-install-docker-repository.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/scripts/ubuntu/1.1-install-docker-repository.sh b/scripts/ubuntu/1.1-install-docker-repository.sh index 004aeac7..ad520a26 100755 --- a/scripts/ubuntu/1.1-install-docker-repository.sh +++ b/scripts/ubuntu/1.1-install-docker-repository.sh @@ -24,23 +24,22 @@ source "$SCRIPT_DIR/utils.sh" print_start_of_script set +e -print_script_step "Verify docker.download.com is reachable" -# Verify docker.download.com is reachable before attempting to install the +print_script_step "Verify download.docker.com is reachable" +# Verify download.docker.com is reachable before attempting to install the # Docker Package Repo (network randomly fails after service restarts). for i in {1..5} do - timeout 2 bash -c "(echo >/dev/tcp/docker.download.com/80) &>/dev/null" - retVal=$? - if [ $retVal -eq 0 ]; then - echo "The docker.download.com is reacheable" + status_code=$(sudo curl -sS -o /dev/null -w "%{http_code}" --connect-timeout 1 "https://download.docker.com" ${https_proxy+--proxy $https_proxy} ) + if [ $? -eq 0 ] && [ "$status_code" -lt 400 ]; then + echo "The download.docker.com is reacheable" break else - echo "The docker.download.com is unreachable for try $i" + echo "The download.docker.com is unreachable for try $i" sleep $(expr $i \* 2) fi if [ "$i" -eq '5' ]; then - echo "Failed to stablish connection with the docker.download.com service." + echo "Failed to stablish connection with the download.docker.com service." echo "Please verify your connection or try again later." exit 1 fi @@ -52,7 +51,7 @@ print_script_step "Add Docker's official GPG key" sudo apt-get update -y sudo apt-get install ca-certificates curl -y sudo install -m 0755 -d /etc/apt/keyrings -sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc +sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc ${https_proxy+--proxy $https_proxy} sudo chmod a+r /etc/apt/keyrings/docker.asc print_script_step "Add the repository to Apt sources" From c3a1b1bea5e987d7c6658de3fe92fda69484e812 Mon Sep 17 00:00:00 2001 From: Arnaud RICHARD Date: Wed, 16 Jul 2025 11:28:08 +0200 Subject: [PATCH 2/3] typo in output message Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- scripts/ubuntu/1.1-install-docker-repository.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ubuntu/1.1-install-docker-repository.sh b/scripts/ubuntu/1.1-install-docker-repository.sh index ad520a26..d0e240d2 100755 --- a/scripts/ubuntu/1.1-install-docker-repository.sh +++ b/scripts/ubuntu/1.1-install-docker-repository.sh @@ -31,7 +31,7 @@ for i in {1..5} do status_code=$(sudo curl -sS -o /dev/null -w "%{http_code}" --connect-timeout 1 "https://download.docker.com" ${https_proxy+--proxy $https_proxy} ) if [ $? -eq 0 ] && [ "$status_code" -lt 400 ]; then - echo "The download.docker.com is reacheable" + echo "The download.docker.com is reachable" break else echo "The download.docker.com is unreachable for try $i" From acc725c6d0f3b7a7f5038d677d586bd5672e3ef4 Mon Sep 17 00:00:00 2001 From: Arnaud RICHARD Date: Wed, 16 Jul 2025 11:28:24 +0200 Subject: [PATCH 3/3] typo in output message Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- scripts/ubuntu/1.1-install-docker-repository.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ubuntu/1.1-install-docker-repository.sh b/scripts/ubuntu/1.1-install-docker-repository.sh index d0e240d2..65093b7c 100755 --- a/scripts/ubuntu/1.1-install-docker-repository.sh +++ b/scripts/ubuntu/1.1-install-docker-repository.sh @@ -39,7 +39,7 @@ do fi if [ "$i" -eq '5' ]; then - echo "Failed to stablish connection with the download.docker.com service." + echo "Failed to establish connection with the download.docker.com service." echo "Please verify your connection or try again later." exit 1 fi