Why docker container exits immediately

后端 未结 15 2362
温柔的废话
温柔的废话 2020-11-22 13:42

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

15条回答
  •  情深已故
    2020-11-22 14:17

    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.

提交回复
热议问题