找出Mac OSX上我的端口80上正在运行的内容

时间:2018-11-16 14:51:13

标签: macos http docker

我正在尝试启动一个hello-world容器应用程序,该应用程序只是在Mac OS X上使用nodejs构建的。

docker run -p 80:80 --name web -d node-hello

343503e8a29ac207c821caa7990373580dd6a1951e1e4936bbf9c71b0eff2213
docker: Error response from daemon: driver failed programming external connectivity on endpoint web (e6035cf3ae4df37f1a96a5a7ed321e6a0ae7ad484c05aae8d7b67f3d86fa3a76): Error starting userland proxy: Bind for 0.0.0.0:80: unexpected error (Failure EADDRINUSE). 

调试步骤

我去了地址

enter image description here

我跑了

lsof -i“:80”

得到

COMMAND   PID  USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
Google    956 bheng  225u  IPv6 0x5bed1c283af57fa7      0t0  TCP [2607:f518:15e:9540:3105:c54f:bd3c:14ed]:63120->yul02s04-in-x10.1e100.net:http (ESTABLISHED)


(netstat -an | grep LISTEN | grep 80) 
tcp4       0      0  127.0.0.1.4380         *.*                    LISTEN                                                                
tcp46      0      0  *.80                   *.*                    LISTEN 

我如何找出80端口当前正在运行的完全

1 个答案:

答案 0 :(得分:0)

使用sudo前缀lsof可以查看您不拥有的进程ID。

SELECT company_name, COUNT(works_in.region_id) AS count FROM companies 
LEFT JOIN works_in ON works_in.company_id = companies.company_id
WHERE EXISTS (
    SELECT region_id1, region_id2 FROM region_borders 
    INNER JOIN works_in w1 ON region_borders.region_id1 = w1.region_id
    INNER JOIN works_in w2 ON region_borders.region_id2 = w2.region_id
    WHERE (region_id1 = works_in.region_id OR region_id2 = works_in.region_id)
    AND w1.company_id = companies.company_id
    AND w2.company_id = companies.company_id
)
GROUP BY company_name
HAVING COUNT(works_in.region_id) = 3