Composefile v2 & default bridge network ERROR: b'Network-scoped alias is supported only for containers in user defined networks' #3012

Closed
niko opened this Issue Feb 24, 2016 · 9 comments

Projects

None yet

6 participants

@niko
niko commented Feb 24, 2016

When using composefile version 2 with the default bridge network this error occurs:

$ docker-compose up
Creating dockercomposetest_debian_1
ERROR: b'Network-scoped alias is supported only for containers in user defined networks'

This is my docker-compose.yml:

version: '2'

services:
  debian:
    image: debian:wheezy

networks:
  default:
    external:
      name: bridge

I'm using compose 1.6.0 and docker 1.10.1.

@dnephin
Member
dnephin commented Feb 24, 2016

To use the bridge network use network_mode: https://docs.docker.com/compose/compose-file/#network-mode

Compose relies on network scoped aliases, so if you try to use bridge as an external network it will set those aliases. If you use network_mode, it will disable the built-in aliases, and rely on the aliases made available by the bridge network.

@niko
niko commented Feb 26, 2016

Thanks! Works like a charm!

@niko niko closed this Feb 26, 2016
@sabberworm
sabberworm commented May 4, 2016 edited

@dnephin Is it possible to join both the bridge external network and other networks at the same time? It seems it should be possible but when I do it like the OP I get the error mentioned and when I use network_mode: bridge I get:

ERROR: 'network_mode' and 'networks' cannot be combined

@ninchan8328
ninchan8328 commented May 16, 2016 edited

Would also like to know if a container can join a default bridge network as a external network and a custom network at the same time. Please help!

@ninchan8328

I figured out, i can have the docker-compose to start the container in a custom network and then do a docker network connect bridge [container] to join the default network that way.

@prologic
prologic commented Jun 4, 2016

I'm also trying to find a way to connect a service to the default bridge network and it's own. @niko ninchan8328 How did you end up doing this? Is there a way to easily do both?

@allamand
allamand commented Jun 6, 2016

regarding this message ERROR: 'network_mode' and 'networks' cannot be combined is there a way for a container to access both user defined overlay networks & physical external network such as host or bridge ?

@ninchan8328

@prologic the way i do is to have the docker-compose spin up the container in its network, then use the docker network connect command to assign the container to different network as needed. I don't think you can do the default bridge and dedicated network at the same time in the compose file but I could be wrong

@prologic
prologic commented Jun 7, 2016

@ninchan8328 Ahh I see. This sounds like a very good use case for a new autodock plugin say autodock-network-attach whose sole responsibility is to listen to started events for any container that have an environment NETWORK_ATTACH=<network1,network2,networkN> for a list of networks to attach to after being brought up.

I'll implement this tonight; because it'll mean that I don't have to use network_mode: "bridge" in many of my services and explicitly attach the ones that need attaching to the "bridge" network :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment