[docker-in-docker] Reverts the retry logic (#659)

* Update install.sh

* [docker-in-docker] Update retry logic

* revert the retry logic!
This commit is contained in:
Samruddhi Khandale 2023-08-18 16:01:50 -07:00 committed by GitHub
parent 9fd5daf06b
commit a4b31f314f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 89 deletions

View file

@ -1,6 +1,6 @@
{
"id": "docker-in-docker",
"version": "2.3.0",
"version": "2.3.1",
"name": "Docker (Docker-in-Docker)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/docker-in-docker",
"description": "Create child containers *inside* a container, independent from the host's docker instance. Installs Docker extension in the container along with needed CLIs.",

View file

@ -423,30 +423,12 @@ dockerd_start="AZURE_DNS_AUTO_DETECTION=${AZURE_DNS_AUTO_DETECTION} DOCKER_DEFAU
INNEREOF
)"
retry_count=0
docker_ok="false"
until [ "${docker_ok}" = "true" ] || [ "${retry_count}" -eq "5" ];
do
# Start using sudo if not invoked as root
if [ "$(id -u)" -ne 0 ]; then
sudo /bin/sh -c "${dockerd_start}"
else
eval "${dockerd_start}"
fi
set +e
docker info > /dev/null 2>&1 && docker_ok="true"
if [ "${docker_ok}" != "true" ]; then
echo "(*) Failed to start docker, retrying in 5s..."
retry_count=`expr $retry_count + 1`
sleep 5s
fi
set -e
done
set +e
# Start using sudo if not invoked as root
if [ "$(id -u)" -ne 0 ]; then
sudo /bin/sh -c "${dockerd_start}"
else
eval "${dockerd_start}"
fi
# Execute whatever commands were passed in (if any). This allows us
# to set this script to ENTRYPOINT while still executing the default CMD.

View file

@ -1,32 +0,0 @@
#!/bin/bash
set -e
# Optional: Import test library
source dev-container-features-test-lib
# Definition specific tests
check "docker-buildx" docker buildx version
check "docker-ps" docker ps
sleep 5s
# Stop docker
pkill dockerd
pkill containerd
sleep 5s
set +e
docker_ok_code="$(docker info > /dev/null 2>&1; echo $?)"
set -e
check "docker-not-running" bash -c "[[ ${docker_ok_code} == 1 ]]"
# Testing retry logic
./test-scripts/docker-test-init.sh
check "docker-started-after-retries" docker ps
# Report result
reportResults

View file

@ -67,11 +67,5 @@
}
},
"remoteUser": "node"
},
"docker_retry": {
"image": "ubuntu:focal",
"features": {
"docker-in-docker": {}
}
}
}

View file

@ -1,26 +0,0 @@
#!/bin/sh
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
retry_count=0
docker_ok="false"
until [ "${docker_ok}" = "true" ] || [ "${retry_count}" -eq "5" ];
do
if [ "${retry_count}" -eq "3" ]; then
echo "Starting docker after 3 retries..."
/usr/local/share/docker-init.sh
fi
set +e
docker info > /dev/null 2>&1 && docker_ok="true"
if [ "${docker_ok}" != "true" ]; then
echo "(*) Failed to start docker, retrying in 5s... Retry count: ${retry_count}"
retry_count=`expr $retry_count + 1`
sleep 1s
fi
set -e
done