"Address already in use" error upon docker-compose up
Asked Answered
W

1

31

I'm trying to start up several docker containers using docker-compose up, but I'm getting the following (partial) error message:

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.

Following a suggestion at https://github.com/docker/docker/issues/8714, I've tried the command

netstat -pna | grep 5672

resulting in

(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    -    

However, I don't see any process IDs here that I could kill. Any ideas what is causing this error?

Weider answered 26/10, 2016 at 15:39 Comment(1)
(Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.)Cravens
W
55

Following https://unix.stackexchange.com/questions/106561/finding-the-pid-of-the-process-using-a-specific-port, instead of netstat I used 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)

After running sudo kill 953, I was able to run the docker-compose up.

Weider answered 26/10, 2016 at 15:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.