Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Docker端口问题绑定:无法分配请求的地址_Docker_Docker Compose - Fatal编程技术网

Docker端口问题绑定:无法分配请求的地址

Docker端口问题绑定:无法分配请求的地址,docker,docker-compose,Docker,Docker Compose,尝试运行时出现以下错误: docker-compose up 错误: dataserver | time="2019-10-13T16:32:41Z" level=info msg="Listening on http://192.168.100.36:5055" dataserver | time="2019-10-13T16:32:41Z" level=fatal msg="listen tcp 192.168.100.36:5055: bind: cannot assign

尝试运行时出现以下错误:

docker-compose up
错误:

dataserver    | time="2019-10-13T16:32:41Z" level=info msg="Listening on http://192.168.100.36:5055"
dataserver    | time="2019-10-13T16:32:41Z" level=fatal msg="listen tcp 192.168.100.36:5055: bind: cannot assign requested address"
dataserver exited with code 1
Windows 10笔记本电脑的端口5055上没有运行任何东西,因此该端口已关闭。所以我的问题是什么导致了这个错误,有什么解决办法


额外信息:

docker-compose.yml

version: "3.7"
services:
  db:
    image: dataserver-db
    container_name: dataserver-db
    restart: "no"
    build:
      context: .
      dockerfile: Dockerfile.database
    networks:
      - network1
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=product
    volumes:
      - type: volume
        source: dataserver-db
        target: /var/lib/postgresql/data
        read_only: false

  dataserver:
    image: dataserver
    container_name: dataserver
    restart: "no"
    build:
      context: .
      dockerfile: Dockerfile
    depends_on:
      - db
    networks:
      - network1
    ports:
      - "5055:5055"
    volumes:
      - type: bind
        # source: /home/user/settings.json
        source: C:/user/settings.json
        target: /app/settings.json
        read_only: true
      - type: bind
        # source: /home/user/control/inbox/
        source: C:/user/product/control/Inbox/
        target: /app/inbox/
        read_only: false

volumes:
  dataserver-db:
    name: dataserver-db

networks:
  network1:
    external:
      name: network1_dataserver

注意:我还是Docker的新手,所以如果需要调试其他任何东西,请告诉我,我会给你。这与“复制”不同,因为它是一台Windows 10计算机,并且端口根据Windows应用程序可用。

最终有效的解决方案是选择一个不同的端口。这似乎奏效了。我把它改为5050。

可能是@adii Nope的副本,而不是副本。端口可用,这也是一台Windows 10计算机。