mirror of https://github.com/docker/compose.git
Merge pull request #2334 from dnephin/dont_set_hostname
Don't set the hostname to the service name with networking.
This commit is contained in:
commit
917b885a44
|
@ -601,9 +601,6 @@ class Service(object):
|
||||||
container_options['hostname'] = parts[0]
|
container_options['hostname'] = parts[0]
|
||||||
container_options['domainname'] = parts[2]
|
container_options['domainname'] = parts[2]
|
||||||
|
|
||||||
if 'hostname' not in container_options and self.use_networking:
|
|
||||||
container_options['hostname'] = self.name
|
|
||||||
|
|
||||||
if 'ports' in container_options or 'expose' in self.options:
|
if 'ports' in container_options or 'expose' in self.options:
|
||||||
ports = []
|
ports = []
|
||||||
all_ports = container_options.get('ports', []) + self.options.get('expose', [])
|
all_ports = container_options.get('ports', []) + self.options.get('expose', [])
|
||||||
|
|
|
@ -205,7 +205,6 @@ class CLITestCase(DockerClientTestCase):
|
||||||
containers = service.containers()
|
containers = service.containers()
|
||||||
self.assertEqual(len(containers), 1)
|
self.assertEqual(len(containers), 1)
|
||||||
self.assertIn(containers[0].id, network['Containers'])
|
self.assertIn(containers[0].id, network['Containers'])
|
||||||
self.assertEqual(containers[0].get('Config.Hostname'), service.name)
|
|
||||||
|
|
||||||
web_container = self.project.get_service('web').containers()[0]
|
web_container = self.project.get_service('web').containers()[0]
|
||||||
self.assertFalse(web_container.get('HostConfig.Links'))
|
self.assertFalse(web_container.get('HostConfig.Links'))
|
||||||
|
|
|
@ -213,16 +213,6 @@ class ServiceTest(unittest.TestCase):
|
||||||
opts = service._get_container_create_options({'image': 'foo'}, 1)
|
opts = service._get_container_create_options({'image': 'foo'}, 1)
|
||||||
self.assertIsNone(opts.get('hostname'))
|
self.assertIsNone(opts.get('hostname'))
|
||||||
|
|
||||||
def test_hostname_defaults_to_service_name_when_using_networking(self):
|
|
||||||
service = Service(
|
|
||||||
'foo',
|
|
||||||
image='foo',
|
|
||||||
use_networking=True,
|
|
||||||
client=self.mock_client,
|
|
||||||
)
|
|
||||||
opts = service._get_container_create_options({'image': 'foo'}, 1)
|
|
||||||
self.assertEqual(opts['hostname'], 'foo')
|
|
||||||
|
|
||||||
def test_get_container_create_options_with_name_option(self):
|
def test_get_container_create_options_with_name_option(self):
|
||||||
service = Service(
|
service = Service(
|
||||||
'foo',
|
'foo',
|
||||||
|
|
Loading…
Reference in New Issue