Update bin/docker-traverse.sh

This commit is contained in:
Kasper Juul Hermansen 2023-07-27 12:20:14 +02:00
parent f33b9a7afa
commit 9b4a2018c6
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912

View File

@ -29,12 +29,12 @@ function extract_docker_image {
# Save the Docker image as a tar file # Save the Docker image as a tar file
echo "Saving Docker image as a tar file..." >&2 echo "Saving Docker image as a tar file..." >&2
docker save "$1" -o "${DESTINATION}/${IMAGE_NAME}.tar" docker save "$1" -o "${DESTINATION}/image.tar"
# Extract the Docker image layers to the destination directory # Extract the Docker image layers to the destination directory
echo "Extracting Docker image layers..." >&2 echo "Extracting Docker image layers..." >&2
mkdir -p "${DESTINATION}/layers" mkdir -p "${DESTINATION}/layers"
tar -xf "${DESTINATION}/${IMAGE_NAME}.tar" -C "${DESTINATION}/" tar -xf "${DESTINATION}/image.tar" -C "${DESTINATION}/"
# Rename the layer directories to their respective layer IDs # Rename the layer directories to their respective layer IDs
LAYERS=$(jq -r '.[0].Layers[]' "${MANIFEST}") LAYERS=$(jq -r '.[0].Layers[]' "${MANIFEST}")