簡體   English   中英

殺死dotnet進程時殺死docker容器

[英]killing docker container when killing dotnet process

我正在運行一個帶有 dotnet 基本映像的 docker 容器,我想在 10 分鍾后殺死整個容器。 我想如果我用以下方法殺死 dotnet 進程:

Process.GetCurrentProcess().Kill();

它應該殺死容器,因為它是啟動容器的進程,但它不工作。 有人可以告訴我在特定時間后殺死容器的最佳方法是什么?

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.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM