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?
If port is in use by another container, stop it with docker-compose stop <service-name-in-compose-file> or remove it by replacing stop with rm . Run docker ps to see list of all containers running under your host. If you find the port is in use by another container, you can stop it with docker stop <container-id> .
8080:80 refers that in the container you are using port 80 and you are forwarding that port to host machine's 8080 port. So you are running Jenkins on port 80 inside your container wherever in scenario 2 you are running Jenkins on port 8080 inside the container and exposing it over the same port on host machine.
Remove all Containers: To remove all containers from the docker-machine, we need to get the ids of all the containers. We can simply get the ids of the containers with the command docker ps -aq, then by using the docker rm command, we can remove all the containers in the docker-machine.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With