Cannot pull a .NET image on Ubuntu AMD built on macOS

This is reasonably insane.

I have been at this all day.

I am trying to build an image on macOS (M1) to be deployed onto Ubuntu (AMD64). I have tried every permutation of the advice I can find online and none of it is working. I cannot pull the image on the Ubuntu box.

Top of my dockerfile looks like this:

FROM mcr.microsoft.com/dotnet/aspnet:8.0.3-jammy-chiseled-extra-amd64 AS base
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build

and I am building it like this:

docker buildx build -t mytag . --push

When I pull this image on the Ubuntu box, I get the message:

no matching manifest for linux/amd64 in the manifest list entries

I am literally specifying the AMD image in the dockerfile.

If I specify the platform in the build command, the dotnet restore fails, which is the problem reported in that link.

Has anyone managed this??

Do I need to configure my local docker somehow?

(system will not let me link to the other post!)

I formatted your post this time. Please follow this guide to use code blocks next time. How to format your forum posts

Regarding the issue, I guess this is just a test Dockerfile as the first FROM instruction would be ignored this way so it doesn’t matter how specific its architecture is.

On the other hand, I ran it and it didn’t show any error message. What does this command show you?

docker buildx ls

If you have multiple builders, you might need to switch to desktop-linux

docker buildx use desktop-linux