Linux x86_64 binaries on ARM64
- Run Linux x32 binary on ARM-based Mac
- Run Linux x64 binary on ARM-based Mac
- Run Linux x32 binary on Mac M1
- Run Linux x63 binary on Mac M1
- Run Linux x86_64 on ARM-based Mac
- Run Linux x86_64 on Mac M1
We need to create an empty Docker container (based on Linux image), mount the local directory with your binary and just run it!
No QEMU, no Parallels, no RosettaVM or other stuff needed. Follow these steps.
Step 1
- Install Docker
- After installation, go to Docker Settings -> Features in development -> Check “Use Rosetta for x86/amd64 emulation on Apple Silicon” and save (may be absent on newer versions – just skip then).
Step 2
Create a file named Dockerfile with content:
FROM --platform=linux/amd64 ubuntu:23.10
RUN apt-get update && apt-get install -y mc
I recommend installing mc (it is Midnight Commander) to have a convenient way to browse files inside your container later. You may later type “mc” in container’s terminal and thereby open file browser.
If you need JVM or other stuff, add them this way:
FROM --platform=linux/amd64 ubuntu:23.10
RUN apt-get update && apt-get install -y mc && apt-get install -y default-jre && whatever
Step 3
Build & run container with just one command (execute this command from the directory with the file we created on the previous step):
docker run --platform linux/amd64 -td --name your-container-name \
-v /Users/<user-name>/<folder-to-mount>:/target \
-it $(docker build -q .)
This folder: /Users/<user-name>/<folder-to-mount> will be mounted to /target inside your container.
Step 4
Connect to the container:
docker exec -it your-container-name /bin/bash
After you’ll execute this command, you may interact with your container directly.
For example, open Midnight Commander (type mc to the shell after the command above), navigate to /taget and run your binary.