.NET Core Container Built with VSTS won't run on Linux
I am using Visual Studio Team Services to build a .NET Core container with the
aspnetcore image. If I build the image from source on a Linux machine, I can run it and
curl localhost works great.
However, the same exact code running in VSTS, building the same image, yields a different result. I’m using the “Hosted Linux Preview” to build the image, which works. The CI build succeeds and uploads the image to my private Azure registry. When I run that image, on the same Linux machine mentioned above, it exits immediately with this error in the log:
Did you mean to run dotnet SDK commands? Please install dotnet SDK from:...
Here is the Dockerfile:
FROM microsoft/aspnetcore:1.1 WORKDIR /app COPY published . ENV ASPNETCORE_URLS http://+:80 EXPOSE 80 ENTRYPOINT ["dotnet", "ContainerPOC.dll"]
One Solution collect form web for “.NET Core Container Built with VSTS won't run on Linux”
The error is caused by what looks like a bug in the dotnet Publish task on VSTS. When this command is configured:
dotnet publish --output publish
This is executed:
dotnet publish --output publish/s
/s causes the output to go to a subfolder called “s” in the publish folder. I changed the Dockerfile to reflect this location (the COPY directive) and all is well.
The error is reproducible:
- Comment out the
- Build the image
- Run a container from the image and execute an interactive bash shell
- Execute the
dotnetcommand and specify an assembly name that is not present in the working directory
Did you mean..? error will appear. Not a very descriptive error given the situation.