3

Doing this on windows 10:

>docker-compose -f docker-compose.yml build
Building MyApprestapi
Step 1/17 : FROM microsoft/aspnetcore:2.0 AS base
 ---> 6237a4750408
Step 2/17 : WORKDIR /app
Removing intermediate container ae0057e8752c
 ---> d422fca6b533
Step 3/17 : EXPOSE 11001
 ---> Running in 70f6f9a9d052
Removing intermediate container 70f6f9a9d052
 ---> 673d1c1d8f34
Step 4/17 : FROM microsoft/aspnetcore-build:2.0 AS build
 ---> f5f1d9a332af
Step 5/17 : WORKDIR /src
Removing intermediate container 0c5e68914dfd
 ---> 035e0d5467bf
Step 6/17 : COPY MyAppPipeline.sln ./
 ---> b0ccbf6431b4
Step 7/17 : COPY MyAppRestApi/MyAppRestApi.csproj MyAppRestApi/
 ---> 3216ad77f880
Step 8/17 : RUN dotnet restore -nowarn:msb3202,nu1503
 ---> Running in f0b9fa8dbbd4
C:\Program Files\dotnet\sdk\2.1.200\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.TargetFrameworkInference.targets(135,5): error : The current .NET SDK does not support targeting .NET Core 2.1.  Either target .NET Core 2.0 or lower, or use a version of the .NET SDK that supports .NET Core 2.1. [C:\src\MyAppRestApi\MyAppRestApi.csproj]
ERROR: Service 'MyApprestapi' failed to build: The command 'cmd /S /C dotnet restore -nowarn:msb3202,nu1503' returned a non-zero code: 1

And if I do:

>dotnet --info

.NET Core SDK (reflecting any global.json): Version: 2.1.300 Commit: adab45bf0c

Runtime Environment: OS Name: Windows OS Version: 10.0.17134 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.1.300\

Host (useful for support): Version: 2.1.0 Commit: caa7b7e2ba

.NET Core SDKs installed: 1.0.0-preview2-003131 [C:\Program Files\dotnet\sdk] 2.1.2 [C:\Program Files\dotnet\sdk] 2.1.104 [C:\Program Files\dotnet\sdk] 2.1.300 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 1.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

1 Answer 1

5

The problem was my DockerFile which was generated at the time of project creation. I had to use the replacements listed here:

https://github.com/dotnet/dotnet-docker

microsoft/dotnet:2.1-aspnetcore-runtime
microsoft/dotnet:2.1-sdk
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.