This warning message indicates that there is a platform mismatch between the requested image and the host platform. The requested image was likely built for the Linux/amd64 platform, but the host platform where the image is being executed is Linux/arm64/v8.
This can cause compatibility issues and may result in errors or unexpected behavior. To resolve this issue, you may need to obtain a version of the image that is compatible with the host platform, or update the host platform to match the platform for which the image was built. But before that, let us understand the problem statement more deeply.
Meet Rosetta 2…
Rosetta 2 is a dynamic binary translator designed by Apple for use on Mac computers with Apple Silicon processors. It allows these computers to run software that was originally designed for Macs with Intel processors, which used a different instruction set architecture (ISA) called x86.
How it works?
Rosetta 2 works by translating x86 instructions into ARM instructions, which are the ISA used by Apple Silicon processors. This translation happens in real-time as the software is running, which means that most applications can be used without any noticeable performance penalty.
Rosetta 2 is included with macOS Big Sur, which was released in November 2020. It runs automatically when you try to open an app that was built for x86 processors, and it usually works seamlessly in the background without any user intervention.
In addition to allowing Macs with Apple Silicon processors to run x86 applications, Rosetta 2 also includes some optimizations that can improve performance for certain types of software. For example, Rosetta 2 can use the neural engine in Apple Silicon processors to accelerate machine learning workloads.
Rosetta 2 is an important tool that allows Mac users to continue using their favorite software while transitioning to a new hardware platform. It demonstrates Apple’s commitment to providing a smooth and seamless user experience, even during major platform transitions.
How to run x86 containers on Apple Mac M1 Pro
There are a few workarounds you can use to run x86 containers on your Apple Silicon Mac. One option is to use a virtualization solution like Parallels Desktop or VMware Fusion to run a full-fledged virtual machine that can run x86 containers. Another option but the easiest one is to use a tool like Docker Desktop for Mac, which includes a built-in virtualization solution that allows you to run x86 containers on your Mac. Running x86 containers on Apple Silicon Macs just got easier thanks to newly added Docker’s Rosetta support.
Rosetta is for AMD64 binaries of Docker itself, QEMU is for running the containers. New Beta feature for MacOS 13, Rosetta for Linux, has been added for faster emulation of Intel-based images on Apple Silicon.
Pre-requisite:
-
Docker Desktop 4.16
-
Enable Rosetta 2 Virtualization feature in Docker Desktop
Go to the Settings > section and check the box to enable the Apple Virtualization framework.
Under the “Feature in development section”, enable Rosetta.
After changing these settings, the Docker Desktop app may restart before becoming available again.
Run x86 containers with Rosetta
If you want to build and run x86 container images using Rosetta, use the platform flag as in the following commands:
docker build --platform linux/amd64 -t nginx:latest .
docker run --platform linux/amd64 nginx:latest
Using Docker Compose
Here’s an example of a Docker Compose file that specifies the platform as linux/amd64:
services:
web:
platform: linux/amd64
image: nginx:latest
ports:
- "8080:80"
In this example, we have a single service called web that uses the nginx:latest image, which is built for the linux/amd64 platform. We’ve also specified that the service should be accessible on port 8080 on the host machine, which is mapped to port 80 inside the container.
Further Reading
-
Testcontainers and Playwright
Discover how Testcontainers-Playwright simplifies browser automation and testing without local Playwright installations. Learn about its features, limitations, compatibility, and usage with code examples.
-
Docker and Wasm Containers – Better Together
Learn how Docker Desktop and CLI both manages Linux containers and Wasm containers side by side.
-
All Things Cloud Native Meetup: Join Us in Bengaluru! 🌟
Are you passionate about Cloud-Native technologies? Do you enjoy exploring topics like Docker, Kubernetes, GitOps, and cloud transformation? Then mark your calendars! Devtron, Nokia, and Collabnix are collaborating to host “All Things Cloud-Native,” an extraordinary gathering for cloud-native enthusiasts, technologists, and DevOps experts. It’s an opportunity to immerse yourself in the latest trends, tools, and…
-
How Do Coaxial Pogo Pins Differ from Standard Pogo Pins?
In the world of electronics, connectors play a critical role in ensuring seamless communication between components. Among these connectors, pogo pins stand out as versatile and reliable solutions, offering both flexibility and precision. Within the pogo pin category, two primary types are commonly discussed: standard pogo pins and coaxial pogo pins. While they share similarities…
-
How SAST Enhances DevOps Pipeline Security
Static Application Security Testing (SAST) plays a crucial role in enhancing the security of DevOps pipelines. By integrating SAST early in the development process, teams can identify vulnerabilities right within developers’ integrated development environments (IDEs). This proactive approach allows for faster remediation and reduces the likelihood of security issues appearing later in the pipeline. While…