summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoffrey F <f.joffrey@gmail.com>2016-07-26 15:45:09 -0700
committerGitHub <noreply@github.com>2016-07-26 15:45:09 -0700
commite7198ad94e6de718e02995ccaab42e42e570d7ec (patch)
treec577e536d89e05a730a86b9746dabe59af83e381
parent106c08faba302bb2454b86c7ff2b8d115d2cf072 (diff)
parent0e68b0a42989fa8f072acde2f947055ae7d64d7a (diff)
downloaddocker-py-e7198ad94e6de718e02995ccaab42e42e570d7ec.tar.gz
Merge pull request #1137 from aanand/default-to-npipe-on-windows
Default to npipe address on Windows
-rw-r--r--docker/utils/utils.py4
-rw-r--r--tests/unit/utils_test.py4
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'