diff --git a/docker/utils/utils.py b/docker/utils/utils.py index 4e48fc7e..4d218692 100644 --- a/docker/utils/utils.py +++ b/docker/utils/utils.py @@ -36,6 +36,8 @@ from .types import Ulimit, LogConfig DEFAULT_HTTP_HOST = "127.0.0.1" DEFAULT_UNIX_SOCKET = "http+unix://var/run/docker.sock" +DEFAULT_NPIPE = 'npipe:////./pipe/docker_engine' + BYTE_UNITS = { 'b': 1, 'k': 1024, @@ -390,7 +392,7 @@ def parse_host(addr, is_win32=False, tls=False): path = '' if not addr and is_win32: - addr = '{0}:{1}'.format(DEFAULT_HTTP_HOST, 2375) + addr = DEFAULT_NPIPE if not addr or addr.strip() == 'unix://': return DEFAULT_UNIX_SOCKET diff --git a/tests/unit/utils_test.py b/tests/unit/utils_test.py index 128778f1..68484fe5 100644 --- a/tests/unit/utils_test.py +++ b/tests/unit/utils_test.py @@ -419,11 +419,11 @@ class ParseHostTest(base.BaseTestCase): def test_parse_host_empty_value(self): unix_socket = 'http+unix://var/run/docker.sock' - tcp_port = 'http://127.0.0.1:2375' + npipe = 'npipe:////./pipe/docker_engine' for val in [None, '']: assert parse_host(val, is_win32=False) == unix_socket - assert parse_host(val, is_win32=True) == tcp_port + assert parse_host(val, is_win32=True) == npipe def test_parse_host_tls(self): host_value = 'myhost.docker.net:3348'