check context in use targets a docker engine

Signed-off-by: aiordache <anca.iordache@docker.com>
This commit is contained in:
aiordache 2020-06-26 16:29:07 +02:00 committed by Ulysses Souza
parent b61fb7ef90
commit bff44e6943
2 changed files with 6 additions and 1 deletions

View File

@ -144,6 +144,11 @@ def docker_client(environment, version=None, context=None, tls_version=None):
if tls:
context.set_endpoint("docker", host=host, tls_cfg=tls, skip_tls_verify=not verify)
if not context.is_docker_host():
raise UserError(
"The platform targeted with the current context is not supported.\n"
"Make sure the context in use targets a Docker Engine.\n")
kwargs['base_url'] = context.Host
if context.TLSConfig:
kwargs['tls'] = context.TLSConfig

View File

@ -5,7 +5,7 @@ certifi==2020.4.5.1
chardet==3.0.4
colorama==0.4.3; sys_platform == 'win32'
distro==1.5.0
docker==4.2.1
docker==4.2.2
docker-pycreds==0.4.0
dockerpty==0.4.1
docopt==0.6.2