Docker build fails with platform manifest error when using ASP.NET framework base image

I’m running into an issue when trying to build my Docker container. The build process stops and shows this error message:

failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest

This happens when I try to build using this Docker configuration:

FROM mcr.microsoft.com/dotnet/framework/runtime:4.8
COPY ./app /inetpub/wwwroot

I’m not sure what’s causing this platform mismatch problem. Has anyone encountered this before? The error seems to be related to the base image I’m using but I can’t figure out what’s wrong with it. Any help would be appreciated.

This happens when Docker can’t find an image that works with your system. The .NET Framework 4.8 runtime image only runs on Windows containers. If you’re using Docker in Linux mode or on a non-Windows machine, switch Docker Desktop to Windows container mode. Better yet, migrate to mcr.microsoft.com/dotnet/aspnet images - they work cross-platform. Run docker version to check your current mode and look at the OS/Arch fields.

Hmm, interesting. What platform are you building on? I’ve seen this happen when building windows containers on linux hosts. Are you using docker desktop or running on a linux machine? Also, does the same thing happen if you pull that base image directley first?

u might be trying to run a Windows container on Linux. That framework image only works on Windows hosts - better switch to the Linux ASP.NET Core images if ur on Linux/Mac.