mirror of https://github.com/docker/compose.git
Use docker.client.create_host_config
create_host_config from docker.utils will be deprecated so that the new create_host_config has access to the _version so we can ensure that network_mode only gets set to 'default' by default if the version is high enough and won't explode. Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
This commit is contained in:
parent
f49fc1867c
commit
42c890796b
|
@ -11,7 +11,6 @@ from operator import attrgetter
|
|||
import enum
|
||||
import six
|
||||
from docker.errors import APIError
|
||||
from docker.utils import create_host_config
|
||||
from docker.utils import LogConfig
|
||||
from docker.utils.ports import build_port_bindings
|
||||
from docker.utils.ports import split_port
|
||||
|
@ -678,7 +677,7 @@ class Service(object):
|
|||
|
||||
devices = options.get('devices', None)
|
||||
|
||||
return create_host_config(
|
||||
return self.client.create_host_config(
|
||||
links=self._get_links(link_to_self=one_off),
|
||||
port_bindings=port_bindings,
|
||||
binds=options.get('binds'),
|
||||
|
|
|
@ -813,6 +813,13 @@ class ServiceTest(DockerClientTestCase):
|
|||
for k, v in {'FILE_DEF': 'F1', 'FILE_DEF_EMPTY': '', 'ENV_DEF': 'E3', 'NO_DEF': ''}.items():
|
||||
self.assertEqual(env[k], v)
|
||||
|
||||
def test_with_high_enough_api_version_we_get_default_network_mode(self):
|
||||
# TODO: remove this test once minimum docker version is 1.8.x
|
||||
with mock.patch.object(self.client, '_version', '1.20'):
|
||||
service = self.create_service('web')
|
||||
service_config = service._get_container_host_config({})
|
||||
self.assertEquals(service_config['NetworkMode'], 'default')
|
||||
|
||||
def test_labels(self):
|
||||
labels_dict = {
|
||||
'com.example.description': "Accounting webapp",
|
||||
|
|
Loading…
Reference in New Issue