Compose: docker-compose version '3' cannot try to use pre-exist overlay network.

Created on 1 Feb 2017  ·  3Comments  ·  Source: docker/compose

Hi, I try to make compose file that deploy to swarm mode.

First, sorry for my English and

Second, my docker and compose versions are
docker : 1.3.0
docker-compose : 1.10.

I made a docker-compose file somthing like below.

version: "3"

services:
  redis:
    image: myrepo/redis:latest
    volumes:
      - /home/user/docker/discourse/redis:/var/lib/redis:Z

  web:
    image: myrepo/web:latest
    env_file: .env
    deploy:
      replicas: 2
      update_config:
        parallelism: 1

networks:
  default:
    external:
      name: test_overlay

I already make test_overlay network.

And after trying sudo docker stack deploy --compose-file=docker-compose.yml test I got Error response from daemon: network test_default not found

I think compose ignore the pre-exist network name and try to find {stack_name_default} network.

Am I missing something?

When I try to using bridge network and docker-compose up, it works fine.

areconfig arenetworking formav3 kinquestion

Most helpful comment

You can't substitute the default network like that. You'll need to name it and reference it explicitly in your service configurations.

version: "3"

services:
  redis:
    networks:
      - ovl_net
    image: myrepo/redis:latest
    volumes:
      - /home/user/docker/discourse/redis:/var/lib/redis:Z

  web:
    image: myrepo/web:latest
    networks:
      - ovl_net
    env_file: .env
    deploy:
      replicas: 2
      update_config:
        parallelism: 1

networks:
  ovl_net:
    external:
      name: test_overlay

All 3 comments

Mine is working.. Created with --driver overlay and --attachable...

You can't substitute the default network like that. You'll need to name it and reference it explicitly in your service configurations.

version: "3"

services:
  redis:
    networks:
      - ovl_net
    image: myrepo/redis:latest
    volumes:
      - /home/user/docker/discourse/redis:/var/lib/redis:Z

  web:
    image: myrepo/web:latest
    networks:
      - ovl_net
    env_file: .env
    deploy:
      replicas: 2
      update_config:
        parallelism: 1

networks:
  ovl_net:
    external:
      name: test_overlay

@shin- Thank you. It works. I'll close this issue.

Was this page helpful?
0 / 5 - 0 ratings