Compose: Compose network configuration not following docker0 network setup

Created on 1 Sep 2016  路  4Comments  路  Source: docker/compose

I have a situation where I needed to run the docker daemon with --bip=192.168.50.1/24 flag, this made sure that my containers get started in that network range by default, thanks to the newly configured docker0 bridge.
As expected, every time I execute docker run ...... my containers get the appropriate IP in the 192 network.
The issue with docker-compose up is that the containers get created in their own network, using a default network of 172.X.X.X, now I know that I can create my own network and configure it accordingly, which is what I did in my compose file, however it feels as if compose's default network should "default" to the docker0 interface?

Using Docker Machine on Virtual Box with docker version 1.12 on Windows 7.

Most helpful comment

It seems that if you use network_mode: bridge in your service configuration it will use the docker0 ip range, and if all services are bridged it won't even try to create a new network interface, which I think is what you expect.

All 4 comments

Yeah! This is a major issue for me as well.

It seems that if you use network_mode: bridge in your service configuration it will use the docker0 ip range, and if all services are bridged it won't even try to create a new network interface, which I think is what you expect.

@AndreLobato you're correct. I tried this and the network is now the same as the docker0 bridge.

I have an opposite problem. Docker compose does not connect containers to docker0 which i need to use postfix running on host machine.

Was this page helpful?
0 / 5 - 0 ratings