Install dotnet core tool Dockerfile

前端 未结 2 1970
梦如初夏
梦如初夏 2021-01-03 08:28

I have an .net core application where I would like to make a SonarBuild inside a container.

So I have a Dockerfile like this:

FROM microsoft/aspnetco         


        
2条回答
  •  春和景丽
    2021-01-03 09:32

    FROM microsoft/aspnetcore-build as build-env
    

    That's the issue. Look at the dockerhub page for this: https://hub.docker.com/r/microsoft/aspnetcore-build/. See how it says that it only supports versions 1.1 and 2.0:

    Latest images for 2.1 and newer are now available on microsoft/dotnet. See this link for more details about migrating to 2.1.

    dotnet tool is only available in 2.1 and later. That's why doing RUN dotnet tool install --global dotnet-sonarscanner fails. dotnet doesn't know about a dotnet tool command at all. It tries to look for dotnet-tool in your $PATH, as a fallback, but no such thing exists either.

    You actual fix was:

    FROM microsoft/dotnet:2.1-sdk as build-env
    

    Because this uses the new 2.1 SDK, which does know of the dotnet tool command.

提交回复
热议问题