However when I use this command I get the following error:
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Then I tried a fix that was suggested upon searching it up, by adding the --platform flag
The platform tag wont help you here.
The problem is that you are running on ARM64/v8 (Raspberry pi 4 maybe?)
But the image is only made for AMD64 cpus: Docker Hub
So, you need to find another image, or make it yourself
I have another question that is similar to this. I have built an image that is based on the golang:latest image on my M1 mac laptop. On docker hub there it says this golang:latest image is supported on arm64v8 architecture. I built the image successfully, however when running the image in a container using docker run --platform linux/arm64/v8 verification the following error message comes up:
standard_init_linux.go:219: exec user process caused: exec format error
I am currently trying to run the container on an M1 (apple silicon). I even used the platform tag in the build and run command to ensure it is using the arm64/v8 version of the golang:latest image because I am running on an M1 laptop. I dont really understand why the container doesn’t run successfully even though I am using the the image with the matching architecture of my host machine.
This is my Dockerfile:
FROM golang:latest
# Set default destination directory in the image
WORKDIR /app
# Copy services into the image
COPY ./ ./
# Download Go modules
RUN go mod download
# Run make to build the verification service
RUN make -C verification
EXPOSE 8080
# Run
CMD [ "verification/cmd/verification-service" ]
Maybe I miss the point, but this is what the --platform option is for on a machine that supports emulation. You set the platform to one of supported platforms and Docker Desktop for Mac will emulate the supported architecture. So you can use amd64 images on arm64 CPUs.
Did you get the same error message or something else? It worked for me on my Mac.
I guess you copied a binary which is not compatible with chosen platform (architecture). What is in
You’re so right @rimelek, i just totally missed the fact that he wrote " Apple M1 ", where --platform should work, but this feature on M1 is “best effort” since there are some limitation regarding the emulation
@rimelek thanks it was because the binary for the wrong architecture was already present and my Dockerfile kept coping that over. Its fixed now, thank you!