diff --git a/docker/client.py b/docker/client.py index 9012d24c..28c315de 100644 --- a/docker/client.py +++ b/docker/client.py @@ -65,6 +65,11 @@ class DockerClient: 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: ``auto`` diff --git a/docker/utils/utils.py b/docker/utils/utils.py index f36a3afb..1c99926a 100644 --- a/docker/utils/utils.py +++ b/docker/utils/utils.py @@ -367,6 +367,8 @@ def kwargs_from_env(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: @@ -385,6 +387,8 @@ def kwargs_from_env(environment=None): verify=tls_verify, ) + params['version'] = docker_api_version + return params