12

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 ?

Juliatzin
  • 18,455
  • 40
  • 166
  • 325
  • 1
    Port 2049 is the NFS server port. Is your host running an NFS server? This would prevent anything else from binding on that port. The fact that your `netstat` output does not show a PID for port 2049 suggests that it is a kernel service using this port. – larsks Apr 05 '19 at 13:30
  • not that I know. I'm under ubuntu 18.04, let me check – Juliatzin Apr 05 '19 at 13:31
  • 1
    I did the trick: sudo apt remove nfs-kernel-server ! you can put it as an answer ! Thanks ! – Juliatzin Apr 05 '19 at 13:34
  • Posted as answer. Glad to help! – larsks Apr 05 '19 at 13:40

2 Answers2

32

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

Jason J. Nathan
  • 7,422
  • 2
  • 26
  • 37
Truong Dang
  • 3,119
  • 1
  • 15
  • 21
8

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.

larsks
  • 277,717
  • 41
  • 399
  • 399