mirror of https://github.com/docker/compose.git
Merge pull request #1580 from aanand/dont-set-network-mode-when-none-is-specified
Don't set network mode when none is specified
This commit is contained in:
commit
911cd60360
|
@ -188,7 +188,7 @@ class Project(object):
|
|||
del service_dict['net']
|
||||
|
||||
else:
|
||||
net = 'bridge'
|
||||
net = None
|
||||
|
||||
return net
|
||||
|
||||
|
|
|
@ -457,7 +457,7 @@ class Service(object):
|
|||
|
||||
def _get_net(self):
|
||||
if not self.net:
|
||||
return "bridge"
|
||||
return None
|
||||
|
||||
if isinstance(self.net, Service):
|
||||
containers = self.net.containers()
|
||||
|
|
|
@ -209,6 +209,18 @@ class ProjectTest(unittest.TestCase):
|
|||
], None)
|
||||
self.assertEqual(project.get_service('test')._get_volumes_from(), container_ids)
|
||||
|
||||
def test_net_unset(self):
|
||||
mock_client = mock.create_autospec(docker.Client)
|
||||
project = Project.from_dicts('test', [
|
||||
{
|
||||
'name': 'test',
|
||||
'image': 'busybox:latest',
|
||||
}
|
||||
], mock_client)
|
||||
service = project.get_service('test')
|
||||
self.assertEqual(service._get_net(), None)
|
||||
self.assertNotIn('NetworkMode', service._get_container_host_config({}))
|
||||
|
||||
def test_use_net_from_container(self):
|
||||
container_id = 'aabbccddee'
|
||||
container_dict = dict(Name='aaa', Id=container_id)
|
||||
|
|
Loading…
Reference in New Issue