From e5031f7e919e1360ad0d4249609e3e609173ca50 Mon Sep 17 00:00:00 2001 From: Kinara Shah Date: Wed, 5 May 2021 15:44:18 -0700 Subject: [PATCH] (cherry-pick) Fix flaky arm64 emulator issue https://github.com/docker/buildx/issues/542 --- hack/init-buildx.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hack/init-buildx.sh b/hack/init-buildx.sh index bac68e1ae1..83b7780507 100755 --- a/hack/init-buildx.sh +++ b/hack/init-buildx.sh @@ -50,6 +50,15 @@ if ! grep -q "^Driver: docker$" <<<"${current_builder}" && \ exit 0 fi +# Ensure qemu is in binfmt_misc +# Docker desktop already has these in versions recent enough to have buildx +# We only need to do this setup on linux hosts +if [ "$(uname)" == 'Linux' ]; then + # NOTE: this is pinned to a digest for a reason! + # https://github.com/docker/buildx/issues/542#issuecomment-778835576 + docker run --rm --privileged tonistiigi/binfmt --uninstall qemu-aarch64 && docker run --rm --privileged tonistiigi/binfmt --install arm64 + docker run --rm --privileged tonistiigi/binfmt +fi # Ensure we use a builder that can leverage it (the default on linux will not) docker buildx rm ingress-nginx || true