diff --git a/bin/docker-push b/bin/docker-push index 0df56cf6..668f6d0b 100755 --- a/bin/docker-push +++ b/bin/docker-push @@ -31,7 +31,18 @@ then exit 1 fi -docker tag -f "${DOCKERTAG}:latest" "${EXTERNAL_REGISTRY_BASE_DOMAIN}/${REPOSITORY_NAME}:${CI_REF}" +DOCKER_TAG_COM="docker tag" +version=$(docker version | grep -e Version | head -n 1 | awk '{ print $2 }') +major=$(echo "${version}" | awk -F. '{ print $1 }') +minor=$(echo "${version}" | awk -F. '{ print $2 }') + +if [[ "${minor#0}" -le 9 && "${major}" -eq 1 ]] || [ "${major}" -eq 0 ] +then + DOCKER_TAG_COM="${DOCKER_TAG_COM} -f " +fi + +$DOCKER_TAG_COM "${DOCKERTAG}:latest" "${EXTERNAL_REGISTRY_BASE_DOMAIN}/${REPOSITORY_NAME}:${CI_REF}" + if [ $? -ne 0 ] then echo "Unable to tag image, aborting"