5

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

2 Answers 2

1

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.

0

This should now be possible. From https://docs.docker.com/compose/networking :

In v2.1+, overlay networks are always attachable. Starting in Compose file format 2.1, overlay networks are always created as attachable, and this is not configurable. This means that standalone containers can connect to overlay networks. In Compose file format 3.x, you can optionally set the attachable property to false.

You might need to declare your network in docker-compose with these properties :

external: true
driver: overlay

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.