今天用aspnetcore写了个hellowrold,放在docker中运行
dorkerfile:
FROM microsoft/dotnet:2.0-runtime ARG source WORKDIR /public COPY ${source:-obj/Docker/publish} . ENTRYPOINT ["dotnet", "mqnh.study.core.console.dll"]
创建镜像:
docker build -t test-console:1.0 .
启动容器:
docker run --name test-console test-console:1.0
输出:
Did you mean to run dotnet SDK commands? Please install dotnet SDK from: http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
请教各位,这个是什么原因?
参考 https://stackoverflow.com/questions/42893134/dotnet-core-sdk-runtime-on-debian-in-dockers
FROM microsoft/dotnet:2.0-runtime ARG source WORKDIR /public # 这里的路径出问题了,dll没有复制到workdir下
COPY ${source:-obj/Docker/publish} . ENTRYPOINT ["dotnet", "mqnh.study.core.console.dll"]