I am trying to run a .net core 1.0.0 console application inside a docker container.
When I run dotnet run
command from inside the Demo folder on my machine, it works fine; But when run using docker run -d --name demo Demo
, the container exits immediately.
I tried docker logs demo
to check the logs and it just shows the text from the Console.WriteLine:
Demo app running...
and nothing else.
I have uploaded the project at https://github.com/learningdockerandnetcore/Demo
The project contains Programs.cs
, Dockerfile
used to create Demo image, and project.json
file.
You should either run your container in the Interactive mode (with
-i
option). but please note that the background processes will be closed immediately when you run the container so make sure your script is run in the foreground or it simply won't work.