Search code examples
asp.net-core-2.0docker-containerwindows-containerazure-container-registry

.NET Core Container Exits After Run


I have a simple .NET Core API that returns a simple hello world string at port 80, I have built it into a docker container which works. I am able to run it locally in detach mode after building it through visual studio, however after I uploaded it to the azure container registry and tried to pull the container from the azure container registry it will no longer run in detach mode and it exits right after the run command.

NOTE: before I pulled the image from the registry I removed the original version of the image.


Solution

  • It turns out the problem was I was trying to run an image built from my debug environment in visual studio, Once I build the image from release in VS then it worked in detached mode after I pulled it down from the Azure Container Registry. I am assuming (this is the theory I am researching to confirm) the images VS tags as :dev need to be run alongside VS so they can be debugged and stepped through, while the release build images can run without VS.