【问题标题】:Error starting userland proxy: listen tcp 0.0.0.0:2049: bind: address already in use启动用户态代理时出错:监听 tcp 0.0.0.0:2049:绑定:地址已在使用中
【发布时间】:2019-04-05 12:58:27
【问题描述】:

在 Ubuntu 18.04 上,我正在尝试安装 Hyperledger Cello,在安装过程中,我得到:

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.

当试图找出哪个应用程序正在使用 2049 端口时,我会这样做:

➜  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           

但我没有应用名称。

我还尝试使用

删除容器
docker rm -f $(docker ps -aq)

就像在this post 中所说的那样,但它不起作用。

我应该如何释放这个端口?

【问题讨论】:

  • 端口 2049 是 NFS 服务器端口。您的主机是否运行 NFS 服务器?这将防止其他任何东西绑定在该端口上。您的netstat 输出未显示端口 2049 的 PID 这一事实表明它是使用此端口的内核服务。
  • 我不知道。我在ubuntu 18.04下,让我检查一下
  • 我成功了: sudo apt remove nfs-kernel-server !你可以把它作为答案!谢谢!
  • 作为答案发布。很高兴为您提供帮助!

标签: docker ubuntu port bind


【解决方案1】:

你可以试试:

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

既然2049 端口已被杀死,那么再次尝试启动容器...

【讨论】:

  • sudo lsof -i tcp:2049 什么也没给我
  • 这组命令帮我解决了我的问题
【解决方案2】:

看起来好像您的主机上正在运行 NFS 服务器。当您以 root 身份运行 netstat -p ... 并且看不到端口的 PID 时,像这样...

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                 :::*                                -                   

...这通常意味着有一个内核服务绑定到该端口。禁用内核 NFS 服务器(假设您没有使用它)应该允许您运行容器。

【讨论】:

    猜你喜欢
    • 2021-12-31
    • 2019-10-06
    • 1970-01-01
    • 2019-12-01
    • 2023-03-28
    • 1970-01-01
    • 2018-09-21
    • 2018-03-13
    相关资源
    最近更新 更多