I have a .NET 4.6 Console application, that waits on an “Exit” input to close the application:
internal static void RunConsole(string args)
Console.WriteLine(“Type ‘exit’ for shutdown.”);
private static void StopIfExitIsWritten()
var line = Console.In.ReadLine();
if (line != null && line.Equals(“EXIT”, StringComparison.OrdinalIgnoreCase))
Console.WriteLine(“Exit was requested.”);
Executing the application on windows works without any problem. Starting using the Docker “Container Run …” command works without any problems. Starting the Container using “Docker Compose” results in the following Exception:
I added some debug informations behind “Console.ReadLine()”, a “Console.WriteLine(“info”)”, and this output was written permanently.
This means, that “Console.ReadLine()” does not blocks until the user hits “Enter” as described in MSDN.
What can I do to handle this problem?