If -x-networking is used, set the correct API version.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
d5f5eb1924
commit
e2f792c4f4
3 changed files with 18 additions and 9 deletions
|
|
@ -9,7 +9,10 @@ from ..const import HTTP_TIMEOUT
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def docker_client():
|
||||
DEFAULT_API_VERSION = '1.19'
|
||||
|
||||
|
||||
def docker_client(version=None):
|
||||
"""
|
||||
Returns a docker-py client configured using environment variables
|
||||
according to the same logic as the official Docker client.
|
||||
|
|
@ -18,6 +21,8 @@ def docker_client():
|
|||
log.warn('The DOCKER_CLIENT_TIMEOUT environment variable is deprecated. Please use COMPOSE_HTTP_TIMEOUT instead.')
|
||||
|
||||
kwargs = kwargs_from_env(assert_hostname=False)
|
||||
kwargs['version'] = os.environ.get('COMPOSE_API_VERSION', '1.19')
|
||||
kwargs['version'] = version or os.environ.get(
|
||||
'COMPOSE_API_VERSION',
|
||||
DEFAULT_API_VERSION)
|
||||
kwargs['timeout'] = HTTP_TIMEOUT
|
||||
return Client(**kwargs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue