'Error: Failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest when building docker image
I get the error:
failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest
when building the following Dockerfile:
FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8
COPY . /inetpub/wwwroot
Solution 1:[1]
The cause was simple, i had my docker desktop running on linux containers and the image is build from a windows image.
Simply switching to windows containers solved the problem.
The message is clueless, so i hope this save some time to others.
Solution 2:[2]
In my case i was using mac with m1 processor to run a python image, my docker-compose and Dockerfile looked like this:
docker-compose.yml
version: '3.7'
services:
words_bot:
build: .
restart: unless-stopped
Dockerfile:
FROM python:3-onbuild
COPY . /usr/src/app
CMD ["python", "-m", "bot"]
Seems like the image was expecting an x86 host architecture so i was getting the error the OP is referring to.
After I added platform: linux/amd64 into docker-compose.yml everything started working as expected:
version: '3.7'
services:
cng_words_bot:
build: .
platform: linux/amd64
restart: unless-stopped
Solution 3:[3]
Providing platform in docker file on M1 fixed for me
e.g. FROM --platform=linux/amd64 amazonlinux:2018.03
Solution 4:[4]
Docker gets confused with some architecture (M1 for instnce). Make sure to specify the architecture (platform)
services:
service-name:
platform: linux/x86_64. # specify the architecture here
image: some-image
Solution 5:[5]
On macOS with an Intel chip building a "standard" docker image I ran in to this.
Restarting the Docker daemon fixed it for me.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | MiguelSlv |
Solution 2 | konnovdev |
Solution 3 | Manish |
Solution 4 | |
Solution 5 | Chris |