mirror of https://github.com/docker/docker-py.git
Default to npipe address on Windows
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
parent
106c08faba
commit
0e68b0a429
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in New Issue