gpt4 book ai didi

docker - ps aux不显示使用docker启动的进程

转载 作者:行者123 更新时间:2023-12-02 18:29:44 24 4
gpt4 key购买 nike

我正在关注一个教程,其中作者使用docker运行Nginx容器,当作者执行sudo ps aux | grep nginxsudo docker ps时,它显示了同时运行这两个命令的Nginx进程。

当我做同样的事情时

$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 16666ff3a57f 2 years ago 108MB

$ sudo docker run -d -it nginx:latest
1a67431e100da4d655b69879efe19a7e7f05adb34a0619bd3501d0f4a51010ae

$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1a67431e100d nginx:latest "nginx -g 'daemon of…" 7 seconds ago Up 6 seconds 80/tcp gracious_bhabha

$ sudo ps aux | grep nginx
sjeeva 50895 0.0 0.0 2442020 808 s002 S+ 4:54PM 0:00.00 grep nginx

为什么在 ps aux的nginx进程中看不到docker nginx进程?

编辑::
在ubuntu机器上工作正常。这个问题在我的mac中。

最佳答案

Why am I not seeing the docker nginx process in ps aux, while I'm seeing the nginx process for docker ps?



Mac的 docker使用虚拟机(与Linux不同)。这意味着它已经安装在虚拟机上而不是Mac主机上,因此,当您点击 ps aux时,它将列出 主机上的正在运行的进程,而不是虚拟机内部的进程。

Here您可以找到一些解决方案。

关于docker - ps aux不显示使用docker启动的进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51072948/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com