Run dotnet 1.1 using docker

2019-04-05 07:21发布

问题:

I'm trying to run an .NET Core app on my mac. I'm using VS Core and upgraded the project to .NET 1.1. Everything works fine when I run it through VSCode however when I get to run it using Docker it fails.

I do the following steps:

dotnet publish -c Release -o out
docker build -t myApp .

The Dockerfile looks like this:

FROM microsoft/dotnet:1.1.0-preview1-runtime
WORKDIR /service
COPY out ./service/
ENTRYPOINT ["dotnet", "myApp.dll"]

Essentially I'm following the steps from https://github.com/dotnet/dotnet-docker . I'm getting all the time the following error:

Did you mean to run dotnet SDK commands? Please install dotnet SDK from: http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409

I'm not sure what I am missing here...

回答1:

I changed my dockerfile to have the following COPY statement:

COPY out ./

That then made the entrypoint to work because it was then able to find out myApp.dll. I think the message could be improved here, but that's me assuming that's what happened