Kaydet (Commit) 29c67c3a authored tarafından Joffrey F's avatar Joffrey F

Added support for extra_hosts in create_host_config

üst f2ad888e
...@@ -300,7 +300,8 @@ def create_host_config( ...@@ -300,7 +300,8 @@ def create_host_config(
binds=None, port_bindings=None, lxc_conf=None, binds=None, port_bindings=None, lxc_conf=None,
publish_all_ports=False, links=None, privileged=False, publish_all_ports=False, links=None, privileged=False,
dns=None, dns_search=None, volumes_from=None, network_mode=None, 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
): ):
host_config = { host_config = {
'Privileged': privileged, 'Privileged': privileged,
...@@ -341,6 +342,15 @@ def create_host_config( ...@@ -341,6 +342,15 @@ def create_host_config(
port_bindings port_bindings
) )
if extra_hosts:
if isinstance(extra_hosts, dict):
extra_hosts = [
'{0}:{1}'.format(k, v)
for k, v in sorted(six.iteritems(extra_hosts))
]
host_config['ExtraHosts'] = extra_hosts
host_config['PublishAllPorts'] = publish_all_ports host_config['PublishAllPorts'] = publish_all_ports
if links: if links:
......
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