docker / docker/buildx

platform linux/amd64 on Apple Silicon stops on dotnet restore

Open
#1,413 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
4.5k
Forks
682
Avg merge
2d 14h
Merged PRs (30d)
29

Description

I am trying to build a docker image on a MacBook pro that has the M1 Max processor. The project is a .NET Blazor application. Here is the docker file:

FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["WebApi/WebApi.csproj", "WebApi/"]
RUN dotnet restore "WebApi/WebApi.csproj"
COPY . .
WORKDIR "/src/WebApi"
RUN dotnet build "WebApi.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "WebApi.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WebApi.dll"]

If I build using this command:

docker buildx build -f WebApi/Dockerfile .

The build works fine and creates an arm64 image that runs in docker desktop on my MacBook.

If I build using this command to try to build an amd64 image:

docker buildx build --platform linux/amd64 -f WebApi/Dockerfile .

It hangs up when the build gets to this command:

dotnet restore "WebApi/WebApi.csproj"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the linux/amd64 build with docker buildx using WebApi/Dockerfile and observe the dotnet restore step. Compare it with the successful default-platform build and inspect the .NET SDK restore behavior under the amd64 build. Done means the amd64 image build completes past restore and produces a usable image.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, docker, dockerfile
Domain
build-system, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.