.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:

  • Installing SQL alongside a new ASP.Net Core project in Docker
  • Blocking of docker-compose up on ubuntu 16.04
  • InitContainer consume config.template from container image in kubernetes
  • Docker compose share environment variables
  • Invoke docker container from Jenkins pipeline which is also running as docker container on Windows for docker (for Windows 10)
  • Kubernetes Autoscaling Containers
  • 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"]
    

  • Docker node development environment on windows
  • not able to perform gcloud init inside dockerfile
  • Docker and Consul: Pinging services works but curl always returns couldn't connect to host error
  • Keep configuration inside Dockerfile? And is this image production safe?
  • Running a docker container inside another docker container?
  • PHPStorm debug application deployed using docker inside vagrant
  • 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

    The appended /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 ENTRYPOINT directive
    • Build the image
    • Run a container from the image and execute an interactive bash shell
    • Execute the dotnet command and specify an assembly name that is not present in the working directory

    The Did you mean..? error will appear. Not a very descriptive error given the situation.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.