Merge pull request #7563 from aiordache/validate_context_endpoint

Error out when context target is not a docker engine
This commit is contained in:
Ulysses Souza 2020-06-30 18:46:57 +02:00 committed by GitHub
commit 15c1cabdad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -140,6 +140,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

@ -4,7 +4,7 @@ certifi==2020.6.20
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