I want to run a docker container for Ganache
on my MacBook M1, but get the following error:
The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
After this line nothing else will happen anymore and the whole process is stuck, although the qemu-system-aarch64 is running on 100% CPU according to Activity Monitor until I press CTRL+C.
My docker-files come from this repository. After running into the same issues there I tried to isolate the root cause and came up with the smallest setup that will run into the same error.
This is the output of docker-compose up --build
:
Building ganache
Sending build context to Docker daemon 196.6kB
Step 1/17 : FROM trufflesuite/ganache-cli:v6.9.1
---> 40b011a5f8e5
Step 2/17 : LABEL Unlock <[email protected]>
---> Using cache
---> aad8a72dac4e
Step 3/17 : RUN apk add --no-cache git openssh bash
---> Using cache
---> 4ca6312438bd
Step 4/17 : RUN apk add --no-cache python python-dev py-pip build-base && pip install virtualenv
---> Using cache
---> 0be290f541ed
Step 5/17 : RUN npm install -g [email protected]
---> Using cache
---> d906d229a768
Step 6/17 : RUN npm install -g yarn
---> [Warning] The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
---> Running in 991c1d804fdf
docker-compose.yml:
version: '3.2'
services:
ganache:
restart: always
build:
context: ./development
dockerfile: ganache.dockerfile
env_file: ../.env.dev.local
ports:
- 8545:8545
ganache-standup:
image: ganache-standup
build:
context: ./development
dockerfile: ganache.dockerfile
env_file: ../.env.dev.local
entrypoint: ['node', '/standup/prepare-ganache-for-unlock.js']
depends_on:
- ganache
ganache.dockerfile:
The ganache.dockerfile can be found here.
Running the whole project on an older iMac with Intel-processor works fine.
You can even now run ARM or Intel Docker containers on the Apple M1 Mac with Docker Desktop for Mac M1. The default, of course, is to run the ARM version but if you use the –platform linux/amd64 parameter Docker will run the Intel version for you.
You can run both Linux and Windows programs and executables in Docker containers. The Docker platform runs natively on Linux (on x86-64, ARM and many other CPU architectures) and on Windows (x86-64). Docker Inc. builds products that let you build and run containers on Linux, Windows and macOS.
We now have a single command to create the Docker image with multi-architecture support for the hello world PHP application for amd64, arm64, and arm32, and to store the image in Docker Hub.
If you want to run the image on a linux/amd64 platform, you need to build it for that platform. You can do that with docker buildx like this and specify both your platforms docker buildx build --platform linux/amd64,linux/arm64 -t <tag> . What are we using that with the run command?
When I was testing Docker’s initial tutorial when you download for the first time I got the error: The requested image's platform (linux/arm64) does not match the detected host platform (linux/amd64) and nospecific platform was requested. It sucks because I got a new MacBook Pro M1 and I did not know about these issues with arm64 chips and images.
If you experience any issues after upgrading your macOS to version 10.15, you must install the latest version of Docker Desktop to be compatible with this version of macOS. Docker supports Docker Desktop on the most recent versions of macOS. That is, the current release of macOS and the previous two releases.
Try running docker run ubuntu:latest echo hello world instead. this image comes with linux/arm64/v8 architcture comapred to v5 in hello-world:linux (which is the only one that comes with any dort of arm support) Hello World works, yes. But so many other docker images not that we are using in the company. I am only person with M1 : (
If you're planning to run the image in your laptop, you need to build it for the cpu architecture of that particular machine. You can provide the --platform
option to docker build (or even to docker-compose
) to define the target platform you want to build the image for.
For example:
docker build --platform linux/amd64 .
With docker-compose you also have the platform
option.
version: "2.4"
services:
zookeeper:
image: confluentinc/cp-zookeeper:7.1.1
hostname: zookeeper
container_name: zookeeper
platform: linux/amd64
ports:
- "2181:2181"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With