mirror of https://github.com/docker/docker-py.git
From api 1.10 dns and volumes should be transmitted to start()
This commit is contained in:
parent
85ea42ecb3
commit
01b5a7d5e7
|
|
@ -16,6 +16,7 @@ import json
|
||||||
import re
|
import re
|
||||||
import shlex
|
import shlex
|
||||||
import struct
|
import struct
|
||||||
|
import warnings
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import requests.exceptions
|
import requests.exceptions
|
||||||
|
|
@ -137,6 +138,14 @@ class Client(requests.Session):
|
||||||
attach_stdin = True
|
attach_stdin = True
|
||||||
stdin_once = True
|
stdin_once = True
|
||||||
|
|
||||||
|
if utils.compare_version('1.10', self._version) >= 0:
|
||||||
|
message = ('{0!r} parameter has no effect on create_container().'
|
||||||
|
' It has been moved to start()')
|
||||||
|
if dns:
|
||||||
|
warnings.warn(message.format('dns'), FutureWarning)
|
||||||
|
if volumes_from:
|
||||||
|
warnings.warn(message.format('volumes_from'), FutureWarning)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'Hostname': hostname,
|
'Hostname': hostname,
|
||||||
'Domainname': domainname,
|
'Domainname': domainname,
|
||||||
|
|
@ -665,7 +674,8 @@ class Client(requests.Session):
|
||||||
True)
|
True)
|
||||||
|
|
||||||
def start(self, container, binds=None, port_bindings=None, lxc_conf=None,
|
def start(self, container, 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, volumes_from=None):
|
||||||
if isinstance(container, dict):
|
if isinstance(container, dict):
|
||||||
container = container.get('Id')
|
container = container.get('Id')
|
||||||
|
|
||||||
|
|
@ -703,6 +713,14 @@ class Client(requests.Session):
|
||||||
|
|
||||||
start_config['Privileged'] = privileged
|
start_config['Privileged'] = privileged
|
||||||
|
|
||||||
|
if utils.compare_version('1.10', self._version) >= 0:
|
||||||
|
if dns:
|
||||||
|
start_config['Dns'] = dns
|
||||||
|
if volumes_from:
|
||||||
|
if not isinstance(volumes_from, six.string_types):
|
||||||
|
volumes_from = ','.join(volumes_from)
|
||||||
|
start_config['VolumesFrom'] = volumes_from
|
||||||
|
|
||||||
url = self._url("/containers/{0}/start".format(container))
|
url = self._url("/containers/{0}/start".format(container))
|
||||||
res = self._post_json(url, data=start_config)
|
res = self._post_json(url, data=start_config)
|
||||||
self._raise_for_status(res)
|
self._raise_for_status(res)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue