File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -250,7 +250,27 @@ provision:
250250 export DEBIAN_FRONTEND=noninteractive
251251 if [ "{{srcType}}" == "archive" ]; then
252252 {
253- curl -fsSL https://get.docker.com | sh -s -- --channel {{srcArchiveChannel}} --version {{srcArchiveVersion}}
253+ getDockerScript=$(mktemp)
254+ curl --retry 3 --retry-all-errors --retry-delay 5 -fsSL -o "$getDockerScript" https://get.docker.com
255+
256+ attempt=1
257+ max_attempts=3
258+ until [ "$attempt" -gt "$max_attempts" ]; do
259+ echo "Docker install attempt $attempt/$max_attempts"
260+ if sh "$getDockerScript" --channel {{srcArchiveChannel}} --version {{srcArchiveVersion}}; then
261+ break
262+ fi
263+ if [ "$attempt" -eq "$max_attempts" ]; then
264+ echo >&2 "Docker install failed after $max_attempts attempts"
265+ exit 1
266+ fi
267+ echo >&2 "Docker install attempt $attempt failed, retrying after $((attempt * 30))s"
268+ rm -rf /var/lib/apt/lists/partial/* || true
269+ apt-get clean || true
270+ sleep $((attempt * 30))
271+ attempt=$((attempt + 1))
272+ done
273+
254274 sed -i 's|^ExecStart=.*|ExecStart=/usr/bin/dockerd -H fd://{{#if localTCPPort}} -H tcp://0.0.0.0:2375{{/if}} --containerd=/run/containerd/containerd.sock|' /usr/lib/systemd/system/docker.service
255275 systemctl daemon-reload
256276 systemctl restart docker
You can’t perform that action at this time.
0 commit comments