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

时间:2019-10-13 16:49:59

标签: 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 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应用程序可用。

1 个答案:

答案 0 :(得分:0)

最终起作用的解决方案是选择其他端口。这似乎有效。我将其更改为5050。