Qemu error when running gem install bundler on Docker with Apple Silicon M1

  apple-m1, bundler, docker, docker-compose, qemu

When I run docker-compose up I’m getting the following error

qemu: uncaught target signal 6 (Aborted) - core dumped

This is happening when docker-compose is running the command bundle install

 => ERROR [5/6] RUN bundle install --jobs 4 --path .bundle/                                                                                                                  4.2s
------
 > [5/6] RUN bundle install --jobs 4 --path .bundle/:
#10 4.170 Fetching gem metadata from https://rubygems.org/.[BUG] Segmentation fault at 0x0000418f81e2b0
#10 4.177 ruby 2.3.4p301 (2017-03-30 revision 58214) [x86_64-linux]
#10 4.177
#10 4.177 SEGV received in SEGV handler
#10 4.178 -- Control frame information -----------------------------------------------
#10 4.178 SEGV received in SEGV handler
#10 4.178 SEGV received in SEGV handler
#10 4.178 qemu: uncaught target signal 6 (Aborted) - core dumped
#10 4.192 Aborted
------
executor failed running [/bin/sh -c bundle install --jobs 4 --path .bundle/]: exit code: 134

According to this github issue thread on docker’s github – its a qemu related bug:

https://github.com/docker/for-mac/issues/5148#issuecomment-784992663

It mentions that qemu is the upstream component Docker use for running Intel (amd64) containers on M1 (arm64) chips. I checked the qemu repo fora related issues with no luck:

https://gitlab.com/qemu-project/qemu/-/issues?scope=all&utf8=%E2%9C%93&state=opened&search=uncaught+target+signal+6

In my docker-compose file I’ve passed the following config which helped me fix a couple M1 related issue on docker. But this isn’t working for this specific issue.

web:
    platform: linux/amd64
    ...

This issue is happening on the following environment

  • Macbook Pro M1 2020
  • Mac OS Big Sur 11.2.3
  • docker-compose version 1.29.1
  • docker engine: 20.10.6
  • docker desktop 3.3.3(64133)

I’ve also opened an issue on qemu repo as well:
https://gitlab.com/qemu-project/qemu/-/issues/340

Any ideas on how to fix this?

Source: Docker Questions

LEAVE A COMMENT