mirror of https://github.com/docker/compose.git
Merge pull request #2692 from aanand/fix-tls-paramater-error
Catch TLSParameterErrors from docker-py
This commit is contained in:
commit
5b2b4cbb07
|
@ -5,9 +5,11 @@ import logging
|
|||
import os
|
||||
|
||||
from docker import Client
|
||||
from docker.errors import TLSParameterError
|
||||
from docker.utils import kwargs_from_env
|
||||
|
||||
from ..const import HTTP_TIMEOUT
|
||||
from .errors import UserError
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -20,8 +22,16 @@ def docker_client(version=None):
|
|||
if 'DOCKER_CLIENT_TIMEOUT' in os.environ:
|
||||
log.warn('The DOCKER_CLIENT_TIMEOUT environment variable is deprecated. Please use COMPOSE_HTTP_TIMEOUT instead.')
|
||||
|
||||
kwargs = kwargs_from_env(assert_hostname=False)
|
||||
try:
|
||||
kwargs = kwargs_from_env(assert_hostname=False)
|
||||
except TLSParameterError:
|
||||
raise UserError(
|
||||
'TLS configuration is invalid - make sure your DOCKER_TLS_VERIFY and DOCKER_CERT_PATH are set correctly.\n'
|
||||
'You might need to run `eval "$(docker-machine env default)"`')
|
||||
|
||||
if version:
|
||||
kwargs['version'] = version
|
||||
|
||||
kwargs['timeout'] = HTTP_TIMEOUT
|
||||
|
||||
return Client(**kwargs)
|
||||
|
|
Loading…
Reference in New Issue