A dockerfile that builds successfully on a laptop with intel chip doesn't successfully build on a laptop that has an M2/arm/apple silicon chip.
How can I emulate the x86_64/amd64 environment on the arm based mac using Rosetta 2?
What I know so far
- This comment on a GitHub issue mentions Docker Desktop will support emulation of x86_64 architecture in early 2023, so I updated Docker Desktop to the most recent version (4.17.0).
- This comment shows a checkbox titled Use Rosetta for x86/amd64 emulation on Apple Silicon, which I checked (and also ensured Virtualization framework in turned on in the General settings tab is on.
- I restarted both docker and terminal.
Is anything else necessary in order to make the docker build command build for x86_64 architecture using Rosetta 2 emulation, and how can I confirm that it's working as intended?
No that should suffice. Once your X64 docker container is started, you can enter the command line into the docker container and then type
ps -ef. You should then see a list of processes running inside the docker. Each X64 process should be preceded by/rosetta/rosetta. Hope this helps!