简体   繁体   中英

killing docker container when killing dotnet process

I am running a docker container with dotnet base image, I want to kill the whole container after 10 min. I thought if i kill the dotnet process with:

Process.GetCurrentProcess().Kill();

it should kill the container as it was the process that started container but it's not working. Can someone please tell me what's the best way of killing container after some spesific time?

Assuming it's traditional Linux docker (I'm unfamiliar with docker on Windows Server), then you should be able to stop the container by killing the process with pid 1.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM