当我在Docker项目中运行Docker -compose up时,它失败了,并显示以下消息:

启动userland代理时错误:监听tcp 0.0.0.0:3000:绑定:地址已在使用

netstat -pna | grep 3000

显示了这个:

tcp        0      0 0.0.0.0:3000            0.0.0.0:*               LISTEN      -  

我已经试过docker-compose down了,但没用。


当前回答

我遇到了这个问题。我的简单解决方案是从系统中删除mongodb

Ubuntu中删除mongodb的命令:

sudo apt-get purge mongodb mongodb-clients mongodb-server mongodb-dev

sudo apt-get purge mongodb-10gen 

sudo apt-get autoremove

其他回答

这帮助了我:

docker-compose down  # Stop container on current dir if there is a docker-compose.yml
docker rm -fv $(docker ps -aq)  # Remove all containers
sudo lsof -i -P -n | grep <port number>  # List who's using the port

然后: kill -9 <进程id> (macOS)或sudo kill <进程id> (Linux)。

来源:用户Rub21的评论。

对我来说是

启动userland代理错误:监听tcp 0.0.0.0:9000:绑定:地址已经在使用

我所需要的就是在php风暴中关闭调试监听

我有同样的问题,通过停止docker容器,它得到了解决。

sudo docker container stop <container-name>

你可以用下面的命令杀死监听该端口的进程:

kill -9 $(lsof -t -i tcp:<port#>)

ex :

(lsof -t -i tcp:<port#>)

或者ubuntu:

Sudo lsof -t -i:8000 '

lsof的手册页:https://man7.org/linux/man-pages/man8/lsof.8.html

-9是硬杀,不检查任何deps。


(不相关,但可能有用,如果它的PORT 5000神秘)-罪魁祸首进程是由于Mac OS monterery。

端口5000通常用于为本地开发服务器提供服务。当更新到最新的macOS操作系统时,我无法将docker绑定到端口5000,因为它已经在使用中。(您可能会发现一条类似Port 5000已被使用的消息。)

通过运行lsof -i:5000,我发现使用端口的进程名为ControlCenter,这是一个原生macOS应用程序。如果这种情况发生在您身上,即使您使用暴力(并杀死)应用程序,它也会重新启动。在我的笔记本电脑中,lsof -i:5000返回控制中心正在被id为433的进程使用。我可以杀死所有-p 433,但macOS不断重新启动进程。

在这个端口上运行的进程原来是一个AirPlay服务器。你可以在

系统首选项›共享,取消检查AirPlay接收器以释放端口5000。

这很可能是因为你已经在你的主机操作系统上运行了一个web服务器,所以它与Docker试图启动的web服务器冲突。

所以,在尝试其他任何方法之前,先试试下面这句话:

Sudo服务apache2停止;Sudo service nginx stopSudo nginx停止;