Kaydet (Commit) 7750ddec authored tarafından Adrian Slade's avatar Adrian Slade

Allow ExtraHosts to be specified when creating a container

üst 3c48d2d7
......@@ -899,7 +899,7 @@ class Client(requests.Session):
def start(self, container, binds=None, port_bindings=None, lxc_conf=None,
publish_all_ports=False, links=None, privileged=False,
dns=None, dns_search=None, volumes_from=None, network_mode=None,
restart_policy=None, cap_add=None, cap_drop=None, devices=None):
restart_policy=None, cap_add=None, cap_drop=None, devices=None, extra_hosts=None):
if isinstance(container, dict):
container = container.get('Id')
......@@ -932,6 +932,17 @@ class Client(requests.Session):
start_config['Links'] = formatted_links
if extra_hosts:
if isinstance(extra_hosts, dict):
extra_hosts = six.iteritems(extra_hosts)
formatted_extra_hosts = [
'{0}:{1}'.format(k, v) for k, v in sorted(extra_hosts)
]
start_config['ExtraHosts'] = formatted_extra_hosts
start_config['Privileged'] = privileged
if utils.compare_version('1.10', self._version) >= 0:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment