当应用程序在具有aspnetcore的docker容器中退出时返回和错误代码

时间:2017-07-03 02:09:10

标签: docker .net-core

如何使用错误代码退出aspnetcore程序?

例如执行此操作的控制台应用程序:

public class Program
{
    public static void Main(string[] args)
    {
        Environment.Exit(1);
        throw new Exception("Failed");
    }
}

Dockerfile是

FROM microsoft/dotnet:1.1-runtime
ARG source
WORKDIR /app
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "Example.dll"]

容器运行时的输出是

The program '' has exited with code 0 (0x0).

0 个答案:

没有答案