docker: try ipv4 and then ipv6 explicitly
To get the ratelimits: TOKEN=$(curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token) curl --head -H "Authorization: Bearer $TOKEN" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest docker appears to have some simple approach to track ipv6 limits.
This commit is contained in:
+20
-5
@@ -159,13 +159,28 @@ fi
|
||||
log "downloading new addon images"
|
||||
images=$(node -e "const i = require('${box_src_tmp_dir}/src/infra_version.js'); console.log(Object.keys(i.images).map(x => i.images[x]).join(' '));")
|
||||
|
||||
# docker hub only uses first 64 bits for ipv6 addressing. this causes many ipv6 rate limit errors
|
||||
# https://www.docker.com/blog/beta-ipv6-support-on-docker-hub-registry/
|
||||
log "\tPulling docker images: ${images}"
|
||||
for image in ${images}; do
|
||||
while ! docker pull "${image}"; do # this pulls the image using the sha256 but doesn't tag it!
|
||||
log "Could not pull ${image}"
|
||||
sleep 5
|
||||
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}"
|
||||
|
||||
while true; do
|
||||
if 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!
|
||||
docker tag "${ipv6_image_ref}" "${image_ref%@sha256:*}" # this will tag the image for readability
|
||||
docker rmi "${ipv6_image_ref}"
|
||||
break
|
||||
fi
|
||||
log "Could not pull ${ipv6_image_ref} either, waiting for 10s"
|
||||
sleep 10
|
||||
done
|
||||
docker tag "${image}" "${image%@sha256:*}" # this will tag the image for readability
|
||||
done
|
||||
|
||||
if [[ "${is_update}" == "yes" ]]; then
|
||||
|
||||
Reference in New Issue
Block a user