installer: make docker pull timeout if pull hangs

This commit is contained in:
Girish Ramakrishnan
2026-01-13 10:37:14 +01:00
parent 0d2bcbf25b
commit b2c434a1fd

View File

@@ -172,14 +172,15 @@ for image_ref in ${images}; do
ipv4_image_ref="${image_ref/registry.docker.com/registry.ipv4.docker.com}" ipv4_image_ref="${image_ref/registry.docker.com/registry.ipv4.docker.com}"
ipv6_image_ref="${image_ref/registry.docker.com/registry.ipv6.docker.com}" ipv6_image_ref="${image_ref/registry.docker.com/registry.ipv6.docker.com}"
# on some machines, ipv6 pull just hangs
while true; do while true; do
if docker pull "${ipv4_image_ref}"; then # this pulls the image untagged using the sha256 but doesn't tag it! if timeout --kill-after=10s 300s docker pull "${ipv4_image_ref}"; then # this pulls the image untagged using the sha256 but doesn't tag it!
docker tag "${ipv4_image_ref}" "${image_ref%@sha256:*}" # this will tag the image for readability docker tag "${ipv4_image_ref}" "${image_ref%@sha256:*}" # this will tag the image for readability
docker rmi "${ipv4_image_ref}" docker rmi "${ipv4_image_ref}"
break break
fi fi
log "Could not pull ${ipv4_image_ref} , trying IPv6" log "Could not pull ${ipv4_image_ref} , trying IPv6"
if docker pull "${ipv6_image_ref}"; then # this pulls the image untagged using the sha256 but doesn't tag it! if timeout --kill-after=10s 300s docker pull "${ipv6_image_ref}"; then # this pulls the image untagged using the sha256 but doesn't tag it!
docker tag "${ipv6_image_ref}" "${image_ref%@sha256:*}" # this will tag the image for readability docker tag "${ipv6_image_ref}" "${image_ref%@sha256:*}" # this will tag the image for readability
docker rmi "${ipv6_image_ref}" docker rmi "${ipv6_image_ref}"
break break