diff options
author | Joffrey F <joffrey@docker.com> | 2014-12-16 17:15:40 -0800 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2014-12-17 11:44:51 -0800 |
commit | 09a5eb8ae79dcba5c232728c1df3644e5bf72c71 (patch) | |
tree | 2023bee9cf31400ec69ea0542319544d81496d21 | |
parent | 19b1379f17cd3d11a618ae7b0b1b0cf305c2a3e6 (diff) | |
download | docker-py-09a5eb8ae79dcba5c232728c1df3644e5bf72c71.tar.gz |
Prevent start_config from overriding host_config in create if no param is specified
-rw-r--r-- | docker/client.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/docker/client.py b/docker/client.py index af008e8..be27bb8 100644 --- a/docker/client.py +++ b/docker/client.py @@ -917,6 +917,8 @@ class Client(requests.Session): restart_policy=None, cap_add=None, cap_drop=None, devices=None, extra_hosts=None): + start_config = {} + def warn(arg_name, version): warning_message = ( '{0!r} parameter is deprecated for API version >= {1}' @@ -959,9 +961,9 @@ class Client(requests.Session): formatted.append({'Key': k, 'Value': str(v)}) lxc_conf = formatted - start_config = { - 'LxcConf': lxc_conf - } + if lxc_conf: + start_config['LxcConf'] = lxc_conf + if binds: start_config['Binds'] = utils.convert_volume_binds(binds) @@ -970,7 +972,8 @@ class Client(requests.Session): port_bindings ) - start_config['PublishAllPorts'] = publish_all_ports + if publish_all_ports: + start_config['PublishAllPorts'] = publish_all_ports if links: if isinstance(links, dict): @@ -992,7 +995,8 @@ class Client(requests.Session): start_config['ExtraHosts'] = formatted_extra_hosts - start_config['Privileged'] = privileged + if privileged: + start_config['Privileged'] = privileged if utils.compare_version('1.10', self._version) >= 0: if dns is not None: @@ -1030,6 +1034,8 @@ class Client(requests.Session): start_config['Devices'] = utils.parse_devices(devices) url = self._url("/containers/{0}/start".format(container)) + if not start_config: + start_config = None res = self._post_json(url, data=start_config) self._raise_for_status(res) |