小编典典

docker-compose up时出现“地址已在使用中”错误

docker

我正在尝试使用启动多个docker容器docker-compose up,但出现以下(部分)错误消息:

Recreating 1faf02f5d67e_1faf02f5d67e_1faf02f5d67e_1faf02f5d67e_1faf02f5d67e_ipercroncompose_rabbitmq_1

ERROR: for rabbitmq  Cannot start service rabbitmq: driver failed programming external connectivity on endpoint ipercroncompose_rabbitmq_1 (a8ded956e30b922289614bbbc4e4fb773c58688d395895b575a88b638592df94): Error starting userland proxy: listen tcp 0.0.0.0:5672: bind: address already in use
ERROR: Encountered errors while bringing up the project.

按照https://github.com/docker/docker/issues/8714的建议,我尝试了命令

netstat -pna | grep 5672

导致

(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:25672           0.0.0.0:*               LISTEN      -               
tcp6       0      0 :::5672                 :::*                    LISTEN      -               
unix  2      [ ]         DGRAM                    15672    -

但是,我在这里看不到任何可以杀死的进程ID。任何想法是什么导致此错误?


阅读 799

收藏
2020-06-17

共1个答案

小编典典

以下https://unix.stackexchange.com/questions/106561/finding-the-pid-of-the-
process-using-a-specific-
port,而不是netstat我使用的lsof -i

kurt@kurt-ThinkPad:~$ sudo lsof -i :5672 | grep LISTEN
[sudo] password for kurt: 
beam.smp 953 rabbitmq   52u  IPv6  33026      0t0  TCP *:amqp (LISTEN)

运行后sudo kill 953,我能够运行docker-compose up

2020-06-17