繁体   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