当我在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了,但没用。


当前回答

改变network_mode:“bridge”到“host”。

这与

version: '2.2'
services:
  bind:
    image: sameersbn/bind:latest
    dns: 127.0.0.1
    ports:
      - 172.17.42.1:53:53/udp
      - 172.17.42.1:10000:10000
    volumes:
        - "/srv/docker/bind:/data"
    environment:
      - 'ROOT_PASSWORD=secret'
    network_mode: "host"

其他回答

这帮助了我:

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的评论。

我解决了这个sudo服务redis-server停止

我也有同样的问题。我通过停止主机上的Apache2服务来解决这个问题。

更改docker更新的端口比关闭其他使用端口80的服务更有意义。

我已经用另一个端口运行了集装箱,比如……8082: -)