From e78605e23c79cc7a42125fe1dbf48cc8907822df Mon Sep 17 00:00:00 2001 From: Mateusz Zakarczemny Date: Sat, 22 Sep 2018 00:31:12 +0200 Subject: [PATCH] add support of DOCKER_API_VERSION Signed-off-by: Mateusz Zakarczemny --- docker/client.py | 5 +++++ docker/utils/utils.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/docker/client.py b/docker/client.py index 8d4a52b2..a3d429b6 100644 --- a/docker/client.py +++ b/docker/client.py @@ -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`` diff --git a/docker/utils/utils.py b/docker/utils/utils.py index fe3b9a57..2fae3288 100644 --- a/docker/utils/utils.py +++ b/docker/utils/utils.py @@ -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