I run a container in the background using
docker run -d --name hadoop h_Service
it exits quickly. But if I run in the foreground, it works
There are many possible ways to cause a docker to exit immediately. For me, it was the problem with my Dockerfile
. There was a bug in that file. I had ENTRYPOINT ["dotnet", "M4Movie_Api.dll]
instead of ENTRYPOINT ["dotnet", "M4Movie_Api.dll"]
. As you can see I had missed one quotation(") at the end.
To analyze the problem I started my container and quickly attached my container so that I could see what was the exact problem.
C:\SVenu\M4Movie\Api\Api>docker start 4ea373efa21b
C:\SVenu\M4Movie\Api\Api>docker attach 4ea373efa21b
Where 4ea373efa21b is my container id. This drives me to the actual issue.
After finding the issue, I had to build, restore, publish my container again.