mirror of https://github.com/docker/docker-py.git
Sanitize create_container input
Client.create_container takes a volumes_from argument that should be: a string, a list of strings, or None. If an empty list or dict is passed instead, the docker daemon returns a 406 Client Error: Not Acceptable
This commit is contained in:
parent
85ea42ecb3
commit
3198dd9fde
|
@ -121,8 +121,12 @@ class Client(requests.Session):
|
|||
volumes_dict[vol] = {}
|
||||
volumes = volumes_dict
|
||||
|
||||
if volumes_from and not isinstance(volumes_from, six.string_types):
|
||||
volumes_from = ','.join(volumes_from)
|
||||
if volumes_from:
|
||||
if not isinstance(volumes_from, six.string_types):
|
||||
volumes_from = ','.join(volumes_from)
|
||||
else:
|
||||
# Force None, an empty list or dict causes client.start to fail
|
||||
volumes_from = None
|
||||
|
||||
attach_stdin = False
|
||||
attach_stdout = False
|
||||
|
|
Loading…
Reference in New Issue