Skip to content

Commit 882aa21

Browse files
Fix multi arch:
When existing images in the local Docker image cache existed for an image the `--platform` arg doesn't matter. This means that when an existing amd64 image is already in the cache the arm64 pulls will not happen. To fix this we always delete the image before pulling. Signed-off-by: Jacob Weinstock <[email protected]>
1 parent 4bd7ee6 commit 882aa21

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

images/hook-embedded/pull-images.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ function docker_pull_image() {
3636
docker pull --platform=linux/"${arch}" "${image}"
3737
}
3838

39+
function docker_remove_image() {
40+
local image="$1"
41+
42+
docker rmi "${image}" || true
43+
}
44+
3945
function main() {
4046
local dind_container="$1"
4147
local images_file="$2"
@@ -45,7 +51,8 @@ function main() {
4551
# Pull the images
4652
while IFS=" " read -r first_image image_tag || [ -n "${first_image}" ] ; do
4753
echo -e "----------------------- $first_image -----------------------"
48-
docker_pull_image "${first_image}"
54+
docker_remove_image "${first_image}"
55+
docker_pull_image "${first_image}" "${arch}"
4956
done < "${images_file}"
5057

5158
# Save the images
@@ -73,6 +80,7 @@ function main() {
7380
sleep 1
7481
if [[ $(docker inspect -f '{{.State.Status}}' "${dind_container}") == "exited" ]]; then
7582
echo "DinD container exited unexpectedly"
83+
docker logs "${dind_container}"
7684
exit 1
7785
fi
7886
done

0 commit comments

Comments
 (0)