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