File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 524524USER_UID=" $( id -u) "
525525USER_GID=" $( id -g) "
526526
527+ # Disable unset variable errors from here on to support older bash versions
528+ # where "${array[*]}" and "${array[@]}" expressions throw errors (in set -u mode)
529+ # when the array is empty despite otherwise having the correct behaviour.
530+ set +u
531+
527532if [[ -z " ${entrypoint[*]} " ]];
528533then
529534 entrypoint=(" macaron" )
564569# Reference: https://docs.podman.io/en/v4.4/markdown/options/userns.container.html.
565570export PODMAN_USERNS=keep-id
566571
572+ # Pull image based on DOCKER_PULL setting, emulating behaviour of
573+ # docker run --pull ${DOCKER_PULL} ...
574+ # to support older versions of docker that do not support the "--pull" argument.
575+ if [[ " ${DOCKER_PULL} " == " always" ]]; then
576+ docker image pull " ${IMAGE} :${MACARON_IMAGE_TAG} "
577+ elif [[ " ${DOCKER_PULL} " == " missing" ]]; then
578+ docker image inspect " ${IMAGE} :${MACARON_IMAGE_TAG} " & > /dev/null || docker image pull " ${IMAGE} :${MACARON_IMAGE_TAG} "
579+ else
580+ # "${DOCKER_PULL}" == "never"
581+ if ! docker image inspect " ${IMAGE} :${MACARON_IMAGE_TAG} " & > /dev/null; then
582+ echo " Docker image '${IMAGE} :${MACARON_IMAGE_TAG} ' not found locally and DOCKER_PULL == never, aborting"
583+ exit 1
584+ fi
585+ fi
586+
567587docker run \
568- --pull " ${DOCKER_PULL} " \
569588 --network=host \
570589 --rm -i " ${tty[@]} " \
571590 -e " USER_UID=${USER_UID} " \
You can’t perform that action at this time.
0 commit comments