mirror of
https://github.com/docker/compose.git
synced 2025-07-21 12:44:54 +02:00
Use docker-py's default behavior when no explicit host on Windows
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
f65f89ad8c
commit
007cf96452
@ -9,7 +9,6 @@ from docker.tls import TLSConfig
|
|||||||
from docker.utils import kwargs_from_env
|
from docker.utils import kwargs_from_env
|
||||||
|
|
||||||
from ..const import HTTP_TIMEOUT
|
from ..const import HTTP_TIMEOUT
|
||||||
from ..const import IS_WINDOWS_PLATFORM
|
|
||||||
from .errors import UserError
|
from .errors import UserError
|
||||||
from .utils import generate_user_agent
|
from .utils import generate_user_agent
|
||||||
from .utils import unquote_path
|
from .utils import unquote_path
|
||||||
@ -72,9 +71,4 @@ def docker_client(environment, version=None, tls_config=None, host=None,
|
|||||||
|
|
||||||
kwargs['user_agent'] = generate_user_agent()
|
kwargs['user_agent'] = generate_user_agent()
|
||||||
|
|
||||||
if 'base_url' not in kwargs and IS_WINDOWS_PLATFORM:
|
|
||||||
# docker-py 1.10 defaults to using npipes, but we don't want that
|
|
||||||
# change in compose yet - use the default TCP connection instead.
|
|
||||||
kwargs['base_url'] = 'tcp://127.0.0.1:2375'
|
|
||||||
|
|
||||||
return Client(**kwargs)
|
return Client(**kwargs)
|
||||||
|
@ -60,14 +60,6 @@ class DockerClientTestCase(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
self.assertEqual(client.headers['User-Agent'], expected)
|
self.assertEqual(client.headers['User-Agent'], expected)
|
||||||
|
|
||||||
@mock.patch.dict(os.environ)
|
|
||||||
def test_docker_client_default_windows_host(self):
|
|
||||||
with mock.patch('compose.cli.docker_client.IS_WINDOWS_PLATFORM', True):
|
|
||||||
if 'DOCKER_HOST' in os.environ:
|
|
||||||
del os.environ['DOCKER_HOST']
|
|
||||||
client = docker_client(os.environ)
|
|
||||||
assert client.base_url == 'http://127.0.0.1:2375'
|
|
||||||
|
|
||||||
|
|
||||||
class TLSConfigTestCase(unittest.TestCase):
|
class TLSConfigTestCase(unittest.TestCase):
|
||||||
ca_cert = 'tests/fixtures/tls/ca.pem'
|
ca_cert = 'tests/fixtures/tls/ca.pem'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user