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

  • AWS Container Service - what is the logging best practice?
  • Routing Docker traffic through a container
  • How to tag a image(.tar) file of docker(container) while loading into other host?
  • Ansible deploys Docker container to wrong Vagrant VM
  • Docker is filling up my disk space
  • How to connect to service in the host machine from inside a docker container?
  • 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"]

  • Unable to push docker image on local private registry
  • Can't configure locale in Docker image
  • nomad not starting Docker jobs
  • Dynamically load a Ruby container in Docker
  • Node http-proxy in Docker container
  • Start docker-machine On Boot
  • 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.