def docker_client(environment, version=None, tls_config=None, host=None, tls_version=None):
 try:
  kwargs = kwargs_from_env(environment=environment, ssl_version=tls_version)
 except TLSParameterError:
  raise UserError(u'TLS configuration is invalid - make sure your DOCKER_TLS_VERIFY and DOCKER_CERT_PATH are set correctly.\nYou might need to run `eval "$(docker-machine env default)"`')
 if host:
  kwargs[u'base_url'] = host
 if tls_config:
  kwargs[u'tls'] = tls_config
 if version:
  kwargs[u'version'] = version
 timeout = environment.get(u'COMPOSE_HTTP_TIMEOUT')
 if timeout:
  kwargs[u'timeout'] = int(timeout)
 else:
  kwargs[u'timeout'] = HTTP_TIMEOUT
 kwargs[u'user_agent'] = generate_user_agent()
 return APIClient(**kwargs)

def docker_client ( environment , version = None , tls_config = None , host = None , tls_version = None ) : try : kwargs = kwargs_from_env ( environment = environment , ssl_version = tls_version ) except TLSParameterError : raise UserError ( u'TLS configuration is invalid - make sure your DOCKER_TLS_VERIFY and DOCKER_CERT_PATH are set correctly.\nYou might need to run `eval "$(docker-machine env default)"`' ) if host : kwargs [ u'base_url' ] = host if tls_config : kwargs [ u'tls' ] = tls_config if version : kwargs [ u'version' ] = version timeout = environment . get ( u'COMPOSE_HTTP_TIMEOUT' ) if timeout : kwargs [ u'timeout' ] = int ( timeout ) else : kwargs [ u'timeout' ] = HTTP_TIMEOUT kwargs [ u'user_agent' ] = generate_user_agent ( ) return APIClient ( ** kwargs )
returns a docker-py client configured using environment variables according to the same logic as the official docker client .