mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #92184 from dims/set-better-default-for-loading-images
Set better default commands for loading images
This commit is contained in:
commit
c83c4d5453
@ -376,7 +376,16 @@ function try-load-docker-image {
|
|||||||
set +e
|
set +e
|
||||||
local -r max_attempts=5
|
local -r max_attempts=5
|
||||||
local -i attempt_num=1
|
local -i attempt_num=1
|
||||||
until timeout 30 ${LOAD_IMAGE_COMMAND:-docker load -i} "${img}"; do
|
|
||||||
|
if [[ "${CONTAINER_RUNTIME_NAME:-}" == "docker" ]]; then
|
||||||
|
load_image_command=${LOAD_IMAGE_COMMAND:-docker load -i}
|
||||||
|
elif [[ "${CONTAINER_RUNTIME_NAME:-}" == "containerd" ]]; then
|
||||||
|
load_image_command=${LOAD_IMAGE_COMMAND:-ctr -n=k8s.io images import}
|
||||||
|
else
|
||||||
|
load_image_command="${LOAD_IMAGE_COMMAND:-}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
until timeout 30 ${load_image_command} "${img}"; do
|
||||||
if [[ "${attempt_num}" == "${max_attempts}" ]]; then
|
if [[ "${attempt_num}" == "${max_attempts}" ]]; then
|
||||||
echo "Fail to load docker image file ${img} after ${max_attempts} retries. Exit!!"
|
echo "Fail to load docker image file ${img} after ${max_attempts} retries. Exit!!"
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user