32-bit op-mode on x86_64/Linux container on Mac M1

Hi-
I am trying to use Docker on my M1 MacBook to run some tools in an amd64/Linux environment. I am having issues that appear to be related to the lack of support of 64-bit instructions. I am wondering if this a limitation of the Docker Virtual machine.

Docker Version: 04.17.0
Computer: MacBook Pro M1 / macOS (12.6.3)

For example, on my M1 MacBook I tried “docker run -it --rm --platform=linux/amd64 opensuse/leap:15.4”
then lscpu yields:
Architecture: x86_64
CPU op-mode(s): 32-bit

On a x86_64 Linux host, running the same command I see:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit

It seems that the lack of a 64-bit op-mode is causing segmentation faults for the application I am trying to run. Am I doing something incorrectly or is this an issue Docker on Macs or somehow related to the underlying QEMU VM?

1 Like

It is because of the emulation. If you run a docker virtual machine using multipass on your Mac and run the same command you will get the same output. I don’t know the reason, I have never noticed the op-mode.

Since emulation is not always perfect whenever an arm64 version is available, you should use that, unless you want to build an application speifically for amd64 which is not available for arm64. Otherwise you could build a multi-arch image supporting both architectures without the need of emulation.

Thanks. Yes we are hoping to use a Docker VM on our M1/M2 MacBooks to build for an amd64 target. We end up with gcc giving a segmentation fault during build on the MacBook, but not the amd64 Linux host.

Podman on the MacBook also has the same error, so it does seem related to QEMU.

So perhaps we just need to hope and wait for future enhancements to the Docker VM in the somewhat near future?

Since it is not just the issue of Docker Desktop, I am not sure who and when will fix it, but you can do better than just hope. :slight_smile:

If you report it and if it is possible to fix it without waiting for a change in QEMU, I am sure the developers of the Docker Desktop will work on it.

1 Like