installer: make docker pull timeout if pull hangs
This commit is contained in:
@@ -172,14 +172,15 @@ for image_ref in ${images}; do
|
||||
ipv4_image_ref="${image_ref/registry.docker.com/registry.ipv4.docker.com}"
|
||||
ipv6_image_ref="${image_ref/registry.docker.com/registry.ipv6.docker.com}"
|
||||
|
||||
# on some machines, ipv6 pull just hangs
|
||||
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 rmi "${ipv4_image_ref}"
|
||||
break
|
||||
fi
|
||||
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 rmi "${ipv6_image_ref}"
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user