Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker-compose can't connect to external network

I've created an external overlay-network:

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

The network creation succeeds:

$ 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  

When I try to place containers into it in my docker-compose.yml, the creation of the services fails with

$ docker-compose up
Creating service-lb

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

My docker-compose.yml looks like this:

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

Is docker-compose unable to deal with overlay-networks in the scope of a swarm?

Versions:
docker-compose v1.8.0-rc2
docker 1.12.0-rc5
like image 428
Dennis Winter Avatar asked Nov 08 '22 11:11

Dennis Winter


1 Answers

docker-compose is incompatible with swarm mode because it still uses the container API, and swarm mode requires use of the services API. I believe overlay networks in 1.12 only work with swarm mode. So yes, they are incompatible.

like image 120
dnephin Avatar answered Nov 15 '22 05:11

dnephin