Docker 错误绑定:地址已在使用中 [英] Docker Error bind: address already in use

查看:38
本文介绍了Docker 错误绑定:地址已在使用中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

When I run docker-compose up in my Docker project it failes with the following message:

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

<代码>netstat -pna |grep 3000显示这个:

tcp        0      0 0.0.0.0:3000            0.0.0.0:*               LISTEN      -  

我已经尝试过 docker-compose down,但是没有用.

I've already tried docker-compose down, but it doesn't help.

推荐答案

在您的情况下,是其他一些进程正在使用该端口,如注释中所示,sudo netstat -pna |grep 3000 帮助您解决问题.

In your case it was some other process that was using the port and as indicated in the comments, sudo netstat -pna | grep 3000 helped you in solving the problem.

虽然在其他情况下(我自己遇到过很多次),它主要是在其他实例上运行的同一个容器.在那种情况下,docker ps 非常有用,因为我经常让相同的容器在其他目录中运行,然后尝试在使用相同容器名称的其他地方再次运行.

While in other cases (I myself encountered it many times) it mostly is the same container running at some other instance. In that case docker ps was very helpful as often I left the same containers running in other directories and then tried running again at other places, where same container names were used.

docker ps 如何帮助我: docker rm -f $(docker ps -aq) 是我用来删除的简短命令所有容器.

How docker ps helped me: docker rm -f $(docker ps -aq) is a short command which I use to remove all containers.

添加了 docker ps 如何帮助我.

Added how docker ps helped me.

这篇关于Docker 错误绑定:地址已在使用中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆