Docker image platform compatibility issue with MAC Silicon processors(M1/M2)
WARNING: The requested image’s platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested.
Rosetta
Lets know something about it before the fix
Rosetta is a dynamic binary translator developed by Apple Inc. for macOS, an application compatibility layer between different instruction set architectures. It enables a transition to newer hardware, by automatically translating software. The name is a reference to the Rosetta Stone, the artifact which enabled translation of Egyptian hieroglyphs.
The first version of Rosetta, introduced in 2006 in Mac OS X Tiger, was part of the Mac transition from PowerPC processors to Intel processors, allowing PowerPC applications to run on Intel-based Macs. The second version, introduced in 2020 as a component of macOS Big Sur, is part of the Mac transition from Intel processors to Apple silicon, allowing Intel applications to run on Apple silicon Macs.
Reference: wikipedia
How to fix the compatibility issue?
Enable ‘Rosetta’ virtualisation in Docker Desktop settings.
- Open Docker Desktop -> Settings
2. Goto General Tab and enable ‘Use Virtulization framework’
3. Goto ‘Features in development’ tab and make sure ‘Use Rosetta for x86/amd64 emulation on Apple Silicon’ option is enabled
4. Click on ‘Apply & restart’
Build and Run Docker images
Use docker option — platform linux/amd64 to build and run the image
docker build --platform linux/amd64 -t your-image:latest .
docker run --platform linux/amd64 your-image:latest.