0

A previously working (on linux) dockerized project builds okay on my new M1 mac, but fails while running with this error:

qemu: uncaught target signal 11 (Segmentation fault) - core dumped

I know this is due to a different architecture (mac is arm, linux machine was amd) but don't know how to change my project to work. How can I move forward?

My base image is mhart/alpine-node:16, and I am running a Node JS (TypeScript) application.

What I have tried (and thus why this is not a duplicate) - having read many similar threads - but hasn't helped:

  • building for amd/64 (linux/intel arch) which Mac should then virtualise, but this didn't change much.
  • adding a command to the Dockerfile to update qemu RUN apk add --update qemu-x86_64
  • updating base alpine node image to the latest version
  • enabled experimental features in docker desktop
  • from docker desktop I can see images are emulated arm64 architecture. I removed the 'from arm64' platform specifier in my Dockerfile and similar platform override in the docker compose file, I can then build an app image which runs without that amd64 tag. However it then still gets the same issue and fails.
  • trying with a plain node (node14) base image
S..
  • 5,511
  • 2
  • 36
  • 43

1 Answers1

2

Sharing in case it helps anyone else and saves some hours: In the end what worked was changing my base image from mhart/alpine-node:16 to a non-alpine based image node:16.18.1-alpine3.15. There are a section of node images tagged for the M1 (arm64) architecture.

I first tried with the latest 19.1.0-alpine which resolved the above qemu failure but wasn't compatible with my application, so selected a v16 version which was - and problem solved.

If in a similar situation I recommend trying to find any newer images that may have been built with arm64 architectures in mind, perhaps even changing (as in my case) your base image and adjusting the Dockerfile (with the delta of what's missing) to make it work.

S..
  • 5,511
  • 2
  • 36
  • 43