add support of DOCKER_API_VERSION

Signed-off-by: Mateusz Zakarczemny <m.zakarczemny+githyb@gmail.com>
This commit is contained in:
Mateusz Zakarczemny 2018-09-22 00:31:12 +02:00
parent 416ea74e3f
commit e78605e23c
2 changed files with 9 additions and 0 deletions

View File

@ -60,6 +60,11 @@ class DockerClient(object):
A path to a directory containing TLS certificates to use when
connecting to the Docker host.
.. envvar:: DOCKER_API_VERSION
A path to a directory containing TLS certificates to use when
connecting to the Docker host.
Args:
version (str): The version of the API to use. Set to ``auto`` to
automatically detect the server's version. Default: ``1.30``

View File

@ -329,6 +329,8 @@ def kwargs_from_env(ssl_version=None, assert_hostname=None, environment=None):
tls_verify = tls_verify is not None
enable_tls = cert_path or tls_verify
docker_api_version = environment.get('DOCKER_API_VERSION')
params = {}
if host:
@ -356,6 +358,8 @@ def kwargs_from_env(ssl_version=None, assert_hostname=None, environment=None):
assert_hostname=assert_hostname,
)
params['version'] = docker_api_version
return params