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
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
The cause was simple. I had my Docker desktop running on Linux containers and the image was build from a Windows image.
Simply switching to Windows containers solved the problem.
The message is clueless, so I hope this save some time for others.
Providing the platform in the Docker file on M1 fixed it for me.
E.g., FROM --platform=linux/amd64 amazonlinux:2018.03
In my case, I was using a Mac with an 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"]
It 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
Docker gets confused with some architectures like the ARM architecture(M1 for instance). Make sure to specify the architecture (platform).
services:
service-name:
platform: linux/x86_64. # Specify the architecture here
image: some-image
Update:
If you're using an Apple Silicon Chip machine (arm architecture), you shall activate on you Docker Desktop the following features for better virtualization:
Use Virtualization framework
Use Rosetta for x86/amd64 emulation on Apple Silicon
It will use the Rosetta 2
emulator instead of the qemu
one,
The difference is just outstanding.
(Assuming you are running Docker on a Windows platform) To resolve this issue, switch the container from Linux to Windows by right clicking on the Docker icon in the tray (we see this icon near the system clock after starting the Docker Engine) and select the option "Switch to Windows containers..."
Step 1
Step 2
For me, the Docker image itself was not building. So I had to add --platform linux/x86_64
as parameter for docker build
command.
I just stumbled over a similar issue myself when using Docker build on a very simple Dockerfile:
FROM node:lts-alpine
COPY ./ /app/
RUN cd /app && npm ci && npm run build
When running docker build -t foo .
, the OP's error with a slightly different cause came up.
However, when running docker pull node:lts-alpine
first, then repeating that build command, the build was running just fine.
IMHO, this looks like a hiccup in Docker for Windows. Switching to Windows containers didn't seem like a reasonable option here for the base container is pretty valid for a Linux-based context. I tried to switch anyway, but that was bringing up a different error of Docker for Windows, only.
On macOS with an Intel chip, building a "standard" Docker image, I ran into this.
Restarting the Docker daemon fixed it for me.
In my case. I was using a Mac M1, and it was missing a /
, like the following:
How it was:
version: '3.6'
services:
service-name:
build:
# It was without the /, like:
context: .
Fixed:
version: '3.6'
services:
service-name:
build:
# The correct one
context: ./
The error was:
failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: unexpected status code [manifests latest]: 401 Unauthorized
And also I needed to change the credsStore value. More information: docker pull gives error: no basic auth credentials #207
I hope that it helps someone, I spent a lot of time to get it.
Searching for a Docker image tag that works for your hardware architecture fixes it. For instance, if you are using Apple silicon (M1 or M2), the architecture is arm64.
In my case I was simply disconnected from the wifi, so double-check that you're online before spending hours trying to debug the issue!