mirror of https://github.com/docker/compose.git
Don't join the bridge network by default in v2
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
parent
9c91cf2967
commit
e75629392d
|
@ -69,13 +69,18 @@ class Project(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
for service_dict in config_data.services:
|
for service_dict in config_data.services:
|
||||||
|
if use_networking:
|
||||||
networks = project.get_networks(
|
networks = project.get_networks(
|
||||||
service_dict,
|
service_dict,
|
||||||
custom_networks + [project.default_network])
|
custom_networks + [project.default_network])
|
||||||
|
net = Net(networks[0]) if networks else Net("none")
|
||||||
links = project.get_links(service_dict)
|
links = []
|
||||||
volumes_from = get_volumes_from(project, service_dict)
|
else:
|
||||||
|
networks = []
|
||||||
net = project.get_net(service_dict)
|
net = project.get_net(service_dict)
|
||||||
|
links = project.get_links(service_dict)
|
||||||
|
|
||||||
|
volumes_from = get_volumes_from(project, service_dict)
|
||||||
|
|
||||||
project.services.append(
|
project.services.append(
|
||||||
Service(
|
Service(
|
||||||
|
@ -194,9 +199,6 @@ class Project(object):
|
||||||
return links
|
return links
|
||||||
|
|
||||||
def get_net(self, service_dict):
|
def get_net(self, service_dict):
|
||||||
if self.use_networking:
|
|
||||||
return Net(None)
|
|
||||||
|
|
||||||
net = service_dict.pop('net', None)
|
net = service_dict.pop('net', None)
|
||||||
if not net:
|
if not net:
|
||||||
return Net(None)
|
return Net(None)
|
||||||
|
|
|
@ -382,13 +382,16 @@ class CLITestCase(DockerClientTestCase):
|
||||||
self.assertEqual(networks[0]['Driver'], 'bridge')
|
self.assertEqual(networks[0]['Driver'], 'bridge')
|
||||||
|
|
||||||
network = self.client.inspect_network(networks[0]['Id'])
|
network = self.client.inspect_network(networks[0]['Id'])
|
||||||
# print self.project.services[0].containers()[0].get('NetworkSettings')
|
|
||||||
self.assertEqual(len(network['Containers']), len(services))
|
|
||||||
|
|
||||||
for service in services:
|
for service in services:
|
||||||
containers = service.containers()
|
containers = service.containers()
|
||||||
self.assertEqual(len(containers), 1)
|
self.assertEqual(len(containers), 1)
|
||||||
self.assertIn(containers[0].id, network['Containers'])
|
|
||||||
|
container = containers[0]
|
||||||
|
self.assertIn(container.id, network['Containers'])
|
||||||
|
|
||||||
|
networks = container.get('NetworkSettings.Networks').keys()
|
||||||
|
self.assertEqual(networks, [network['Name']])
|
||||||
|
|
||||||
def test_up_with_networks(self):
|
def test_up_with_networks(self):
|
||||||
self.base_dir = 'tests/fixtures/networks'
|
self.base_dir = 'tests/fixtures/networks'
|
||||||
|
|
Loading…
Reference in New Issue