title: Docker errors when trying to build in ARM64 Apple M1: "Failed to resolve full path of the current executable [/proc/self/exe]"
body: <p>I'm having trouble building docker containers on an Apple M1
  The project uses sdk 2.2 which is incompatible with arm64 architecture. So I changed the sdk and aspnet cores to 2.2-alpine3.8 and they seem to build ok but the process fails when it needs to publish</p>
  <p>The docker file:</p>
  <pre><code>FROM mcr.microsoft.com/dotnet/core/sdk:2.2-alpine3.8 AS build-env
  WORKDIR /app
  # Copy csproj and restore as distinct layers
  COPY . .
  RUN dotnet publish src/admin/MyContainer.Admin.csproj -c Release -o ./publish
  
  # Build runtime image
  FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-alpine3.8
  WORKDIR /app
  COPY --from=build-env /app/src/admin/publish .
  
  # Copy script that allows waiting for the database on docker-compose
  # As referenced here https://docs.docker.com/compose/startup-order/
  # This was done because admin starts up very quickly on e2e env
  # and the sqlserver container wasn't getting ready fast enough
  COPY --from=build-env /app/docker-wait-for-it.sh .
  
  EXPOSE 80
  CMD [&quot;dotnet&quot;, &quot;MyContainer.Admin.dll&quot;]
  </code></pre>
  <p>the build command I'm using is:</p>
  <pre><code>docker buildx build --platform linux/arm64/v8 -t MyContainer.azurecr.io/admin-api-web:development ./backend -f ./backend/Admin.Api.Web.Dockerfile
  </code></pre>
  <p>and the log output is:</p>
  <pre><code>[+] Building 0.5s (11/13)                                                                                                                                                                                                                   
   =&gt; [internal] load build definition from Admin.Api.Web.Dockerfile                                                                                                                                                                     0.0s
   =&gt; =&gt; transferring dockerfile: 46B                                                                                                                                                                                                    0.0s
   =&gt; [internal] load .dockerignore                                                                                                                                                                                                      0.0s
   =&gt; =&gt; transferring context: 34B                                                                                                                                                                                                       0.0s
   =&gt; [internal] load metadata for mcr.microsoft.com/dotnet/core/aspnet:2.2-alpine3.8                                                                                                                                                    0.1s
   =&gt; [internal] load metadata for mcr.microsoft.com/dotnet/core/sdk:2.2-alpine3.8                                                                                                                                                       0.1s
   =&gt; [build-env 1/4] FROM mcr.microsoft.com/dotnet/core/sdk:2.2-alpine3.8@sha256:1299ac0379146c1de7b588196727dbd56eace3abfbdd4321c547c9ff4a18a2f7                                                                                       0.0s
   =&gt; =&gt; resolve mcr.microsoft.com/dotnet/core/sdk:2.2-alpine3.8@sha256:1299ac0379146c1de7b588196727dbd56eace3abfbdd4321c547c9ff4a18a2f7                                                                                                 0.0s
   =&gt; [stage-1 1/4] FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-alpine3.8@sha256:4d6e528f4c09c55804b6032ecc5d60565a3ee16f68bb08d2cf337dff99cdb8c3                                                                                      0.0s
   =&gt; =&gt; resolve mcr.microsoft.com/dotnet/core/aspnet:2.2-alpine3.8@sha256:4d6e528f4c09c55804b6032ecc5d60565a3ee16f68bb08d2cf337dff99cdb8c3                                                                                              0.0s
   =&gt; [internal] load build context                                                                                                                                                                                                      0.2s
   =&gt; =&gt; transferring context: 473.91kB                                                                                                                                                                                                  0.1s
   =&gt; CACHED [stage-1 2/4] WORKDIR /app                                                                                                                                                                                                  0.0s
   =&gt; CACHED [build-env 2/4] WORKDIR /app                                                                                                                                                                                                0.0s
   =&gt; CACHED [build-env 3/4] COPY . .                                                                                                                                                                                                    0.0s
   =&gt; ERROR [build-env 4/4] RUN dotnet publish src/admin/MyContainer.Admin.csproj -c Release -o ./publish                                                                                                                                  0.1s
  ------
   &gt; [build-env 4/4] RUN dotnet publish src/admin/MyContainer.Admin.csproj -c Release -o ./publish:
  #11 0.127 Failed to resolve full path of the current executable [/proc/self/exe]
  </code></pre>
  <p>I've tried with different platforms on the --platform flag and without any specified as well... If I try to build with core 2.2 I get this output:</p>
  <pre><code>[+] Building 0.5s (4/4) FINISHED                                                                                                                                                                                                            
   =&gt; [internal] load build definition from Admin.Api.Web.Dockerfile                                                                                                                                                                     0.0s
   =&gt; =&gt; transferring dockerfile: 745B                                                                                                                                                                                                   0.0s
   =&gt; [internal] load .dockerignore                                                                                                                                                                                                      0.0s
   =&gt; =&gt; transferring context: 34B                                                                                                                                                                                                       0.0s
   =&gt; ERROR [internal] load metadata for mcr.microsoft.com/dotnet/core/aspnet:2.2                                                                                                                                                        0.4s
   =&gt; CANCELED [internal] load metadata for mcr.microsoft.com/dotnet/core/sdk:2.2                                                                                                                                                        0.4s
  ------
   &gt; [internal] load metadata for mcr.microsoft.com/dotnet/core/aspnet:2.2:
  ------
  error: failed to solve: failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest sha256:08xxx: not found
  </code></pre>
  <p>Which I've found out to be because core 2.2 has no support form arm64. But this file builds without any errors on an Intel MacBook but with M1 I can't get past the build error. Any ideas?</p>