Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions compose/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,9 +599,6 @@ def _get_container_create_options(
container_options['hostname'] = parts[0]
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:
ports = []
all_ports = container_options.get('ports', []) + self.options.get('expose', [])
Expand Down
1 change: 0 additions & 1 deletion tests/acceptance/cli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ def test_up_with_networking(self):
containers = service.containers()
self.assertEqual(len(containers), 1)
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]
self.assertFalse(web_container.get('HostConfig.Links'))
Expand Down
10 changes: 0 additions & 10 deletions tests/unit/service_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,6 @@ def test_no_default_hostname_when_not_using_networking(self):
opts = service._get_container_create_options({'image': 'foo'}, 1)
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):
service = Service(
'foo',
Expand Down