dockerTools.buildImage: preserve layers ordering at image repacking
This patch preserves the ordering of layers of a parent image when the
new image is packed.
It is currently not the case: layers are stacked in the reverse order.
Fixes #55290
commitda7cd82ab1a7c4134425dbdc91c98b9f0a69abc6
authorAntoine Eiche <lewo@abesis.fr>
dateSat 16 Feb 2019, 00:40 (8 years ago)
parent8568f68
pkgs/build-support/docker/default.nix+1−1
@@ -776,7 +776,7 @@ rec {
776776 imageJson=$(cat ${baseJson} | jq ". + {\"rootfs\": {\"diff_ids\": [], \"type\": \"layers\"}}")
777777 manifestJson=$(jq -n "[{\"RepoTags\":[\"$imageName:$imageTag\"]}]")
778778
779− for layerTar in $(cat ./layer-list); do
779+ for layerTar in $(tac ./layer-list); do
780780 layerChecksum=$(sha256sum image/$layerTar | cut -d ' ' -f1)
781781 imageJson=$(echo "$imageJson" | jq ".history |= [{\"created\": \"$(jq -r .created ${baseJson})\"}] + .")
782782 imageJson=$(echo "$imageJson" | jq ".rootfs.diff_ids |= [\"sha256:$layerChecksum\"] + .")