dockerTools: fix skopeo commands

This commit is contained in:
zowoq 2020-05-25 14:29:54 +10:00
parent 7a2307dc4b
commit 365d07cea0

View File

@ -12,7 +12,6 @@ finalImageTag=
hashType=$NIX_HASH_ALGO
hashFormat=$hashFormat
format=nix
skopeoCmd="skopeo --insecure-policy --tmpdir=$TMPDIR"
usage(){
echo >&2 "syntax: nix-prefetch-docker [options] [IMAGE_NAME [IMAGE_TAG|IMAGE_DIGEST]]
@ -39,7 +38,7 @@ get_image_digest(){
imageTag="latest"
fi
"$skopeoCmd" inspect "docker://$imageName:$imageTag" | jq '.Digest' -r
skopeo --insecure-policy --tmpdir=$TMPDIR inspect "docker://$imageName:$imageTag" | jq '.Digest' -r
}
get_name() {
@ -128,9 +127,9 @@ trap "rm -rf \"$tmpPath\"" EXIT
tmpFile="$tmpPath/$(get_name $finalImageName $finalImageTag)"
if test -z "$QUIET"; then
"$skopeoCmd" --override-os ${os} --override-arch ${arch} copy "$sourceUrl" "docker-archive://$tmpFile:$finalImageName:$finalImageTag"
skopeo --insecure-policy --tmpdir=$TMPDIR --override-os ${os} --override-arch ${arch} copy "$sourceUrl" "docker-archive://$tmpFile:$finalImageName:$finalImageTag"
else
"$skopeoCmd" --override-os ${os} --override-arch ${arch} copy "$sourceUrl" "docker-archive://$tmpFile:$finalImageName:$finalImageTag" > /dev/null
skopeo --insecure-policy --tmpdir=$TMPDIR --override-os ${os} --override-arch ${arch} copy "$sourceUrl" "docker-archive://$tmpFile:$finalImageName:$finalImageTag" > /dev/null
fi
# Compute the hash.