question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The specified RuntimeIdentifier 'linux-linux/amd64' is not recognized

See original GitHub issue

Describe the bug

When building an amd64 container on an arm64 device (MacBook Pro M2) I hit the problem with dotnet restore hanging forever. I mitigated this by using the BUILDPLATFORM env variable in tandem with the 8.0 nightly preview SDK.

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/nightly/sdk:8.0-preview as build-env

This worked well 9 days ago but seemingly running the same command now seems to suggest it’s trying to restore a linux-linux/arm64 RID which won’t exist.

To Reproduce

docker buildx build --platform linux/arm64,linux/amd64 --output "type=image,push=true" --no-cache --file ./Dockerfile . --compress --tag "REDACTED"

I have the relevant portion of my Dockerfile below

RUN echo "I am running on ${BUILDPLATFORM}"
RUN echo "building for ${TARGETPLATFORM}"
RUN export TARGETPLATFORM="${TARGETPLATFORM}"

RUN dotnet restore -a $TARGETPLATFORM

which outputs

 => [linux/arm64 build-env 5/9] RUN echo "I am running on linux/arm64"                                                                                                                             0.2s
 => [linux/arm64->amd64 build-env 5/9] RUN echo "I am running on linux/arm64"                                                                                                                      0.2s
 => [linux/arm64->amd64 build-env 6/9] RUN echo "building for linux/amd64"                                                                                                                         0.0s
 => [linux/arm64 build-env 6/9] RUN echo "building for linux/arm64"                                                                                                                                0.1s
 => [linux/arm64->amd64 build-env 7/9] RUN export TARGETPLATFORM="linux/amd64"                                                                                                                     0.1s
 => [linux/arm64 build-env 7/9] RUN export TARGETPLATFORM="linux/arm64"                                                                                                                            0.0s
 => ERROR [linux/arm64 build-env 8/9] RUN dotnet restore -a linux/arm64                                                                                                                            1.4s
 => ERROR [linux/arm64->amd64 build-env 8/9] RUN dotnet restore -a linux/amd64       

Exceptions (if any)

The specified RuntimeIdentifier ‘linux-linux/amd64’ is not recognized

Further technical details

  • Include the output of dotnet --info
  • The IDE (VS / VS Code/ VS4Mac) you’re running on, and its version

Issue Analytics

  • State:closed
  • Created 6 months ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
adamlonsdalecommented, Apr 11, 2023

hello, I can confirm that on Preview 3 when changing TARGETARCH it does indeed resolve the issue and build the container. Thanks!

0reactions
richlandercommented, Apr 10, 2023

I just tested it. It works for me, on both x64 and Arm64 (with --platform amd64). Can you try this:

$ pwd
/home/rich/git/dotnet-docker/samples/aspnetapp
$ docker build --pull -t aspnetapp --platform amd64 -f Dockerfile.alpine-non-root .

Please clone the repo and build from this directory to validate: https://github.com/dotnet/dotnet-docker/tree/main/samples/aspnetapp

What I see:

$ docker build --pull -t aspnetapp --platform amd64 -f Dockerfile.alpine-non-root .
[+] Building 10.3s (15/15) FINISHED
 => [internal] load build definition from Dockerfile.alpine-non-root                                               0.0s
 => => transferring dockerfile: 54B                                                                                0.0s
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 34B                                                                                   0.0s
 => [internal] load metadata for mcr.microsoft.com/dotnet/nightly/aspnet:8.0-preview-alpine                        0.9s
 => [internal] load metadata for mcr.microsoft.com/dotnet/nightly/sdk:8.0-preview-alpine                           0.2s
 => [build 1/6] FROM mcr.microsoft.com/dotnet/nightly/sdk:8.0-preview-alpine@sha256:75a196c1a3484d1d937eb07efb8c0  0.0s
 => [internal] load build context                                                                                  0.0s
 => => transferring context: 6.79kB                                                                                0.0s
 => [stage-1 1/3] FROM mcr.microsoft.com/dotnet/nightly/aspnet:8.0-preview-alpine@sha256:33db03d4f1828a99a0711ecb  0.1s
 => => resolve mcr.microsoft.com/dotnet/nightly/aspnet:8.0-preview-alpine@sha256:33db03d4f1828a99a0711ecb3c403c81  0.0s
 => => sha256:33db03d4f1828a99a0711ecb3c403c81390d85ef34987e35ce8289ef2f44633d 1.11kB / 1.11kB                     0.0s
 => => sha256:382c700816424f91113d9043c82ee1c6aeeb67dae9370d3279b6fa38b5c70997 1.37kB / 1.37kB                     0.0s
 => => sha256:37c042de115a31844c5eeeca9f31619db70727f7cefb8854afd5fe3fc9eaff4c 4.90kB / 4.90kB                     0.0s
 => CACHED [build 2/6] WORKDIR /source                                                                             0.0s
 => CACHED [build 3/6] COPY aspnetapp/*.csproj .                                                                   0.0s
 => [build 4/6] RUN dotnet restore -a amd64                                                                        3.8s
 => [stage-1 2/3] WORKDIR /app                                                                                     0.0s
 => [build 5/6] COPY aspnetapp/. .                                                                                 0.1s
 => [build 6/6] RUN dotnet publish -a amd64 --no-restore -o /app                                                   5.1s
 => [stage-1 3/3] COPY --from=build /app .                                                                         0.1s
 => exporting to image                                                                                             0.1s
 => => exporting layers                                                                                            0.1s
 => => writing image sha256:a696bf37b41ca95dcfdf2f4ec85430b25cedf2e8ddf51470b85b1bc51bb1c46c                       0.0s
 => => naming to docker.io/library/aspnetapp                                                                       0.0s
$ docker inspect aspnetapp -f "{{.Os}}\{{.Architecture}}"
linux\amd64
Read more comments on GitHub >

github_iconTop Results From Across the Web

error NETSDK1083: The specified RuntimeIdentifier ...
error NETSDK1083 : The specified RuntimeIdentifier 'ubuntu.22.04-x64' is not recognized when doing source building package for Ubuntu Jammy 22.04 ...
Read more >
NET Runtime Identifier (RID) catalog
RID values are used to identify target platforms where the application runs. They're used by .NET packages to represent platform-specific assets ...
Read more >
migrate .net core 2.2 to 3.1 issue
targets(59,5): error NETSDK1083: The specified RuntimeIdentifier 'win7-64' is not recognized. C:\Program Files\dotnet\sdk\3.1.101\Sdks\Microsoft ...
Read more >
RuntimeIdentifiers error when multiple identifiers
Hi,. I'm facing the following error when I have more than one rutimeidentifier: The project 'XXXXXXXXX' ran into a problem during the last ......
Read more >
.NET 6 and M1 problems when other SDKs are present in ...
NET 6, and older SDKs shoved into x64 directory. Steps to reproduce. Try to run .NET 5 or .NET Core 3.1 project: it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found