链接到容器时如何使用主机网络?

sim*_*imo 11 laravel docker docker-compose

在我的docker-compose中:

laravel:
    image: trackware
    links:
        - postgis:postgis
    ports:
        - "80:80"
        - "3306:3306"
        - "443:443"
        - "220:22"
        - "8000:8000"
    net: "host"
    restart:  always
    volumes:
        - C:/H/repositories/pubnub:/share
    container_name: laravel

postgis:
    image: mdillon/postgis
    env_file: .postgis_env
    ports:
        - "9090:9000"
        - "54320:5432"
    container_name: postgis
Run Code Online (Sandbox Code Playgroud)

如果我跑,docker-compose up -d我得到这个错误:

Conflicting options: host type networking can't be used with links. This would result in undefined behavior
Run Code Online (Sandbox Code Playgroud)

那么,net: "host"在链接到postgis容器时我将如何使用?laravel容器需要运行pubnub客户端,这需要高性能的网络来实现实时消息处理,还需要链接到postgis容器来访问db.

那么,有什么建议吗?我正在使用docker 1.10.2

rm *_*-rf 6

由于您将postgis端口暴露给主机,因此您可以跳过链接并通过localhost:9000连接到它.我相信这将有效,因为laravel应用程序驻留在主机网络中,他们将共享这些端口.