windows - Docker Windows容器中的Powershell列表过程产生空列表

标签 windows powershell docker

为了将调试器附加到Windows容器中,我需要获取在Windows容器中运行的dotnet应用程序的进程ID,但是当我尝试列出进程时,我得到一个空列表。

PS > docker exec -it --privileged elated_swartz powershell -Command Get-CimInstance Win32_Process | Select-Object ProcessId, CommandLine

ProcessId CommandLine
--------- -----------

PS版本5.1.15063.483

Docker客户端:
版本:17.06.0-ce
API版本:1.30
Go版本:go1.8.3
Git提交:02c1d87
建成:2017年6月23日星期五21:30:30
操作系统/ Arch:Windows / amd64

Docker服务器:
版本:17.06.0-ce
API版本:1.30(最低版本1.24)
Go版本:go1.8.3
Git提交:02c1d87
建造时间:2017年6月23日星期五22:19:00
操作系统/ Arch:Windows / amd64
实验性:真实

最佳答案

在* nix中:

docker top <container>

在Windows中
使用CMD:
docker exec <container> tasklist

使用Powershell:
docker exec <container> powershell get-process

关于windows - Docker Windows容器中的Powershell列表过程产生空列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45092623/

相关文章:

ruby - File.open 忽略路径

mysql - Docker ufw 连接到主机

Docker容器在杀死后重生

python - 适用于 NodeJS Express 和 Python 的 Docker

Windows Server 2016/2019 错误地返回 Owin.dll 上的 Authenticode 签名

c - 仍然不明白 C 中指向数字数组的指针

c++ - 替代 C/C++ localtime()

powershell - 如何修改cspkg中定义的csdef

powershell - 使用 PowerShell 解除阻止文件?

c# - Powershell 中的 MessageBox 未置于最前面