Segfault for docker image on non native platform

Hello there,

we have a lot of docker images for various microservices built for linux/amd64, which build on top of official docker erlang images (24.x and 25.x). I tried to run some of them on Apple M1 MacBook Pro, but all crashed with segfault. I’ve found that the problem in docker image itself:

% docker run --platform linux/amd64 -ti erlang:25.1
Unable to find image 'erlang:25.1' locally
25.1: Pulling from library/erlang
Digest: sha256:f9ee7e6df6c65a633a1b5e8691ec8787021d57f16a598025a84c05c43e558641
Status: Downloaded newer image for erlang:25.1
qemu: uncaught target signal 11 (Segmentation fault) - core dumped

I guess the problem in JIT, because earlier release images works just fine:

% docker run --platform linux/amd64 -ti erlang:23                       [XP-627-ci]
Erlang/OTP 23 [erts-11.2.2.16] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Eshell V11.2.2.16  (abort with ^G)
1>

So is there any ways to run images built on top of latest Erlang without recompiling them from scratch?

2 Likes

x86 Docker images can be considered non-functional on the new macOS machines. We saw the same with Elastic Search images. You have to use an ARM image on the M1/M2 machines.

2 Likes

Iirc docker just blames qemu for anything not working with x86 on arm.

1 Like

hi @kpy3 ! You should be able to build the image on the M1 and then use that image (and share it) later on. As far as I know, that’s a vendor problem (qemu in this case). I came across this problem a little while ago and this was the ultimate takeaway.

[arm64+otp 25+qemu] `mix local.hex --force` hangs - #4 by pdgonzalez872 - Questions / Help - Elixir Programming Language Forum.

1 Like

Yes, I’ve already rebuilt couple of them, but we had 10x of it, and I hoped to have not-so-long-and-expensive solution for the problem. :sweat_smile:

2 Likes