Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cloud-kubernetes-aspnetcore]:wrong dotnet SDK version #1444

Open
kozuejpg opened this issue Oct 13, 2024 · 0 comments
Open

[cloud-kubernetes-aspnetcore]:wrong dotnet SDK version #1444

kozuejpg opened this issue Oct 13, 2024 · 0 comments

Comments

@kozuejpg
Copy link

When I run docker build command, I met error.

[+] Building 1.5s (11/15)                                                      docker:default
 => [internal] load build definition from Dockerfile                                     0.0s
 => => transferring dockerfile: 836B                                                     0.0s
 => [internal] load metadata for mcr.microsoft.com/dotnet/aspnet:6.0-alpine-amd64        0.3s
 => [internal] load metadata for mcr.microsoft.com/dotnet/sdk:6.0-alpine                 0.3s
 => [internal] load .dockerignore                                                        0.0s
 => => transferring context: 2B                                                          0.0s
 => [build 1/7] FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine@sha256:f8a27715995b21ff0e7  0.0s
 => [runtime 1/3] FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine-amd64@sha256:eceeb165  0.0s
 => [internal] load build context                                                        0.0s
 => => transferring context: 10.13kB                                                     0.0s
 => CACHED [runtime 2/3] WORKDIR /app                                                    0.0s
 => CACHED [build 2/7] WORKDIR /app                                                      0.0s
 => CACHED [build 3/7] COPY *.csproj ./                                                  0.0s
 => ERROR [build 4/7] RUN dotnet restore                                                 1.1s
------                                                                                        
 > [build 4/7] RUN dotnet restore:
0.997   Determining projects to restore...
1.010 /usr/share/dotnet/sdk/6.0.427/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(144,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 8.0.  Either target .NET 6.0 or lower, or use a version of the .NET SDK that supports .NET 8.0. [/app/HelloWorldAspNetCore.csproj]
------

 1 warning found (use docker --debug to expand):
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 25)
Dockerfile:9
--------------------
   7 |     # Copy csproj and restore as distinct layers.
   8 |     COPY *.csproj ./
   9 | >>> RUN dotnet restore
  10 |     
  11 |     # Copy local code to the container image.
--------------------
ERROR: failed to solve: process "/bin/sh -c dotnet restore" did not complete successfully: exit code: 1

I fixed Dockerfile and completed build.
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build

FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build

FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine-amd64 AS runtime

FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine-amd64 AS runtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant