Results of docker build:
λ docker build -t simple-dotnet-api .
Sending build context to Docker daemon 252.4kB
Step 1/4 : FROM mcr.microsoft.com/dotnet/core/sdk:2.2
---> 08663b8eaa01
Step 2/4 : COPY . app/
---> 41fe9231d66e
Step 3/4 : RUN dotnet --version
---> Running in 1c8deb00927c
2.2.300
Removing intermediate container 1c8deb00927c
---> a9d0f880a76f
Step 4/4 : ENTRYPOINT ["dotnet", "app/simple-dotnet-api.dll"]
---> Running in 6d6f9bc34999
Removing intermediate container 6d6f9bc34999
---> 5e915f348c7e
Successfully built 5e915f348c7e
Successfully tagged simple-dotnet-api:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
Result of docker start:
λ docker start -ia condescending_fermat
It was not possible to find any compatible framework version
The specified framework 'Microsoft.AspNetCore.App', version '2.2.0' was not found.
Check application dependencies and target a framework version installed at:
/usr/share/dotnet/
Installing .NET Core prerequisites might help resolve this problem:
https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
The .NET Core framework and SDK can be installed from:
https://aka.ms/dotnet-download
λ dotnet --info
A compatible SDK version for global.json version: [2.2.0] from [C:\Users\coreyp\source\repos\simple-dotnet-api\bin\Release\netcoreapp2.2\publish\global.json] was not found
Host (useful for support):
Version: 2.2.3
Commit: 6b8ad509b6
.NET Core SDKs installed:
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.401 [C:\Program Files\dotnet\sdk]
2.1.504 [C:\Program Files\dotnet\sdk]
2.2.105 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.3-servicing-26724-03 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Dockerfile:
FROM mcr.microsoft.com/dotnet/core/sdk:2.2
COPY . app/
RUN dotnet --version
ENTRYPOINT ["dotnet", "app/simple-dotnet-api.dll"]
我在想,只要简要回顾一下这些内容,即可从容器中下载版本2.2.300,但我的应用程序已设置为2.0.0。但是,我不确定如何解决它。我可以在容器中指定2.0.0吗?我可以强制我的应用使用2.2.300吗?当我尝试这样做时,我无法更新多个依赖项。
科里
答案 0 :(得分:1)
如果您的项目目录中有一个名为“ global.json”的文件,请将其中的sdk目标更新为2.2.300。如果没有该文件,请使用以下内容创建它。
{
"sdk": {
"version": "2.2.300"
}
}