diff options
author | Aanand Prasad <aanand.prasad@gmail.com> | 2016-07-25 14:08:25 +0100 |
---|---|---|
committer | Aanand Prasad <aanand.prasad@gmail.com> | 2016-07-26 11:39:09 +0100 |
commit | 0e68b0a42989fa8f072acde2f947055ae7d64d7a (patch) | |
tree | c577e536d89e05a730a86b9746dabe59af83e381 | |
parent | 106c08faba302bb2454b86c7ff2b8d115d2cf072 (diff) | |
download | docker-py-0e68b0a42989fa8f072acde2f947055ae7d64d7a.tar.gz |
Default to npipe address on Windows
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
-rw-r--r-- | docker/utils/utils.py | 4 | ||||
-rw-r--r-- | tests/unit/utils_test.py | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/docker/utils/utils.py b/docker/utils/utils.py index 4e48fc7..4d21869 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 128778f..68484fe 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' |