I've noticed strange behavior when using docker-compose.
Console.ReadLine() does not wait for user-input.
Observe the following simplified dot net core c# console app:
private static void Main(string[] args)
{
Console.WriteLine("Input something:");
while (true)
{
var line = Console.ReadLine();
Console.WriteLine($"{DateTime.Now} Input was: {line}");
System.Threading.Thread.Sleep(1000);
}
}
If you run this via docker run -i readline it works fine:
But if you use docker-compose up it just loops without waiting for input on STDIN:
Why is that?
You can try it yourself using:
git clone https://github.com/mh-qUjB/docker-dotnetcore-readline.git
cd ./docker-dotnetcore-readline/ReadLine
docker-compose up
I'm currently testing this on:
Ubuntu 16.04Docker version 18.06.1-ce, build e68fc7adocker-compose version 1.22.0, build f46880fe<TargetFramework>netcoreapp2.1</TargetFramework>- Dockerfile see here
Thank you.
PS: if you could improve the title of this question I'd be happy.

