2016-07-27 89 views
2

我創建了一個外部覆蓋網絡:搬運工,撰寫無法連接到外部網絡

docker network create --driver overlay --subnet=10.0.9.0/24 mynetwork 

網絡創建成功:

$ docker network ls 
NETWORK ID   NAME    DRIVER    SCOPE 
37295f249f91  bridge    bridge    local    
c2ec03c99888  docker_gwbridge  bridge    local    
33dd13c9686d  host    host    local    
27goixjy0jys  ingress    overlay    swarm    
75508732fab2  none    null    local    
ef6fti3kq6w4  mynetwork   overlay    swarm 

當我嘗試把集裝箱進去在我docker-compose.yml,服務的創建失敗

$ docker-compose up 
Creating service-lb 

ERROR: for service-lb network mynetwork not found 
ERROR: Encountered errors while bringing up the project. 

docker-compose.yml外觀像這樣:

version: "2" 
services: 
    service-lb: 
     image: myreg:5000/myorg/service-lb:latest 
     ports: 
     - "0.0.0.0:10080:80" 
     dns_search: 
     - . 
     networks: 
     - mynetwork 
networks: 
    mynetwork: 
     external: true 

docker-compose無法在羣的範圍,以應對覆蓋的網絡?

Versions: 
docker-compose v1.8.0-rc2 
docker 1.12.0-rc5 

回答

1

docker-compose與swarm模式不兼容,因爲它仍然使用容器API,並且swarm模式需要使用服務API。我相信1.12中的覆蓋網絡僅適用於羣集模式。所以是的,他們是不相容的。