mirror of
https://github.com/docker/compose.git
synced 2025-04-08 17:05:13 +02:00
Fix running one-off containers with --x-networking by disabling linking to self.
docker create fails if networking and links are used together. Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
88e53e177d
commit
a9b4fe768d
@ -545,6 +545,9 @@ class Service(object):
|
||||
return 1 if not numbers else max(numbers) + 1
|
||||
|
||||
def _get_links(self, link_to_self):
|
||||
if self.use_networking:
|
||||
return []
|
||||
|
||||
links = []
|
||||
for service, link_name in self.links:
|
||||
for container in service.containers():
|
||||
|
@ -444,6 +444,14 @@ class ServiceTest(unittest.TestCase):
|
||||
}
|
||||
self.assertEqual(config_dict, expected)
|
||||
|
||||
def test_get_links_with_networking(self):
|
||||
service = Service(
|
||||
'foo',
|
||||
image='foo',
|
||||
links=[(Service('one'), 'one')],
|
||||
use_networking=True)
|
||||
self.assertEqual(service._get_links(link_to_self=True), [])
|
||||
|
||||
|
||||
class NetTestCase(unittest.TestCase):
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user