【发布时间】:2020-05-09 10:19:32
【问题描述】:
我为 .net 核心控制台应用程序制作了一个 docker 文件:
FROM mcr.microsoft.com/dotnet/core/sdk:3.1
LABEL author="some name"
LABEL description="some description"
ENTRYPOINT [ "dotnet", "L1_1_Console.dll" ]
并从中创建了一个名为“labo1_1_console_image”的图像
当我尝试使用此命令运行此映像时:
docker run --rm -it labo1_1_console_image
我收到此错误:
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET Core program, but dotnet-L1_1_Console.dll does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
我认为问题是第二个问题(我不确定),但我不知道如何解决这个问题,我的 L1_1_Console.dll 文件分别位于 docker 文件位置 /bin/Release/netcoreapp3.1(我也有发布这里的文件夹与相同的文件)
更新:
我将 docker 文件更改为:
FROM mcr.microsoft.com/dotnet/core/sdk:3.1
LABEL author="somename"
LABEL description=" some description"
ADD bin/Release/netcoreapp3.1/publish/L1_1_Console.dll L1_1_Console.dll
ADD bin/Release/netcoreapp3.1/publish/L1_1_Console.runtimeconfig.json L1_1_Console.runtimeconfig.json
ENTRYPOINT [ "dotnet", "L1_1_Console.dll" ]
【问题讨论】:
标签: c# docker .net-core console-application