I have this docker container of a console app that is supposed to get a value from user with Console.Readline
command then continues it's job. However whenever I use a Console.Readline
command inside myapplication and try to create image from it, I get the following exception:
System.IO.IOException: 'The handle is invalid.'
this is my docker file:
FROM mcr.microsoft.com/dotnet/core/runtime:3.1-nanoserver-1903 AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1903 AS build
WORKDIR /src
COPY ["DockerSample/DockerSample.csproj", "DockerSample/"]
RUN dotnet restore "DockerSample/DockerSample.csproj"
COPY . .
WORKDIR "/src/DockerSample"
RUN dotnet build "DockerSample.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "DockerSample.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "DockerSample.dll"]
this is my code in console application:
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
var input=Console.ReadLine();
//do something with my input
}
}