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:
CPU op-mode(s): 32-bit
On a x86_64 Linux host, running the same command I see:
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?
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?