docker run --net =“host”等效于docker-compose

时间:2017-08-28 13:15:53

标签: docker docker-compose

我希望docker-compose使用--net = "host"--net = "host"中运行我的dokcer图像,因为我的码头运行network_mode: "host"工作正常。

但我想用docker-compose做这件事。我还在docker-compose.yml文件中添加了docker-compose.yml。但没机会。这是我的version: '2' services: campaign-app-avano-mci: image: imagename ports: - "4558:4558" network_mode: "host" volumes: - /apps/dockers/campaign-app-avano-mci/:/logs environment: - SDP_MONGO_DATABASE="campaign-app-avano-mci" - SDP_SDK_PORT="4558" - SDP_PLATFORM_URL="host-platform:9600/aban-platform" 文件:

swift

任何建议?

1 个答案:

答案 0 :(得分:1)

使用以下docker-compose.yml文件解决了

问题:

services:
  campaign-app-avano-mci:
    image: imagefile
    network_mode: "host"
    ports:
    - 4558:4558
    volumes:
      - /apps/dockers/campaign-app-avano-mci/:/logs
    environment:
      - SDP_MONGO_DATABASE=campaign-app-avano-mci
      - SDP_SDK_PORT=4558
      - SDP_PLATFORM_URL=host-platform:9600/aban-platform