Enable use of Docker networking with the --x-networking flag

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
Aanand Prasad 2015-10-07 16:10:08 +01:00 • committed by Daniel Nephin
commit d5f5eb1924
14 changed files with 240 additions and 24 deletions

View file

@ -113,6 +113,7 @@ class Service(object):
name,
client=None,
project='default',
use_networking=False,
links=None,
volumes_from=None,
net=None,
@ -124,6 +125,7 @@ class Service(object):
self.name = name
self.client = client
self.project = project
self.use_networking = use_networking
self.links = links or []
self.volumes_from = volumes_from or []
self.net = net or Net(None)
@ -602,6 +604,9 @@ class Service(object):
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', [])