Kate
Kate

Reputation: 181

fabric: external connectivity on enpoint failed: Bind for 0.0.0.0:5984 failed: port is already allocated

When starting my network, I get following errors (docker containers are all deleted) for orderer, peer and couchdb:

e.g.

ERROR: for orderer2.example.com  Cannot start service orderer2.example.com: b'driver failed programming external connectivity on endpoint orderer2.example.com (f52.....): Bind for 0.0.0.0:8050 failed: port is already allocated'
Creating peer1.org1.example.com ... error

ERROR: for peer1.org1.example.com  Cannot start service peer1.org1.example.com: b'driver failed programming external connectivity on endpoint peer1.org1.example.com (d5e2...: Bind for 0.0.0.0:8051 failed: port is already allocated'

ERROR: for couchdb2  Cannot start service couchdb2: b'driver failed programming external connectivity on endpoint couchdb2 (1ef...): Bind for 0.0.0.0:7984 failed: port is already allocated'

I have also the error : Error: No such container: cli

Guess it is something with my docker...

Docker version: 19.03.8 docker compose: 1.20.0

I deleted all container and I also checked this via docker ps -a , which were all empty.

For deletion I used following commands:

docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker volume prune
docker network prune

I also completely removed docker and reinstalled it...

Any idea how I can solve this?

PS. What I don't understand, everything is running without errors on my local machine. Now I want to set it up on a server am facing different errors...

Upvotes: 1

Views: 748

Answers (1)

Aditya Joshi
Aditya Joshi

Reputation: 1053

The error clearly says that the ports you are trying to allocate for your peers, orderer, and CouchDB are already being used by some other service on your host machine.

Try this command on your host machine and you can see the process that is actually using these ports.

netstat -nlp | grep <port>
eg : netstat -nlp | grep 5984

And there you can see the process ID, just kill that process using kill PID and try to rerun the network.

Upvotes: 2

Related Questions