Juliatzin
Juliatzin

Reputation: 19695

Error starting userland proxy: listen tcp 0.0.0.0:2049: bind: address already in use

On Ubuntu 18.04, I'm trying to install Hyperledger Cello, and during the install, I get:

make[2]: Entering directory '/home/julien/cello'
docker-compose -f bootup/docker-compose-files/docker-compose-nfs.yml up -d --no-recreate
WARNING: Found orphan containers (cello-user-dashboard, cello-operator-dashboard, cello-watchdog, cello-keycloak-server, cello-parse-server, cello-dashboard_rabbitmq, cello-mongo, cello-keycloak-mysql, cello-engine) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Starting cello-nfs ... error

ERROR: for cello-nfs  Cannot start service nfs: driver failed programming external connectivity on endpoint cello-nfs (d1be7a4999731983a12df9f1fb6484c7adf669be7edf01c6d962856ed8a6846f): Error starting userland proxy: listen tcp 0.0.0.0:2049: bind: address already in use

ERROR: for nfs  Cannot start service nfs: driver failed programming external connectivity on endpoint cello-nfs (d1be7a4999731983a12df9f1fb6484c7adf669be7edf01c6d962856ed8a6846f): Error starting userland proxy: listen tcp 0.0.0.0:2049: bind: address already in use
ERROR: Encountered errors while bringing up the project.

When trying to figure out which application is using 2049 port, I do:

➜  cello git:(master) ✗ sudo netstat -pna | grep 2049
tcp        0      0 0.0.0.0:2049            0.0.0.0:*               LISTEN      -                   
tcp6       0      0 :::2049                 :::*                    LISTEN      -                   
udp        0      0 0.0.0.0:2049            0.0.0.0:*                           -                   
udp6       0      0 :::2049                 :::*                                -                   
unix  3      [ ]         STREAM     CONNECTED     204951   18122/brave --type=  
unix  3      [ ]         STREAM     CONNECTED     204950   5193/brave           

But I get no app name.

I also tried to remove containers with

docker rm -f $(docker ps -aq)

like said in this post, but it didn't work.

How should I do to free this port ?

Upvotes: 12

Views: 27996

Answers (2)

Truong Dang
Truong Dang

Reputation: 3417

You can try :

docker stop $(docker ps -a -q)
docker ps # again to make sure containers is off
sudo lsof -i tcp:2049 # now you get and list of process running and using 2049 port find and copy PID
sudo kill -9 yout_PID

Now that the 2049 port is killed, then try start containers again...

Upvotes: 32

larsks
larsks

Reputation: 311645

It looks as if you have an NFS server running on your host. When you run netstat -p ... as root and you don't see a PID for a port, like this...

tcp        0      0 0.0.0.0:2049            0.0.0.0:*               LISTEN      -                   
tcp6       0      0 :::2049                 :::*                    LISTEN      -                   
udp        0      0 0.0.0.0:2049            0.0.0.0:*                           -                   
udp6       0      0 :::2049                 :::*                                -                   

...it generally means there is a kernel service bound to that port. Disabling the kernel NFS server (assuming that you're not using it) should allow you to run your container.

Upvotes: 9

Related Questions