Skip to content

Commit e6601e2

Browse files
committed
Remove default adapters when connecting through a unix socket.
Signed-off-by: Joffrey F <[email protected]>
1 parent df50df3 commit e6601e2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

docker/client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def __init__(self, base_url=None, version=None,
6060
if base_url.startswith('http+unix://'):
6161
self._custom_adapter = UnixAdapter(base_url, timeout)
6262
self.mount('http+docker://', self._custom_adapter)
63+
self._unmount('http://', 'https://')
6364
self.base_url = 'http+docker://localunixsocket'
6465
elif base_url.startswith('npipe://'):
6566
if not constants.IS_WINDOWS_PLATFORM:
@@ -368,6 +369,10 @@ def _get_result_tty(self, stream, res, is_tty):
368369
[x for x in self._multiplexed_buffer_helper(res)]
369370
)
370371

372+
def _unmount(self, *args):
373+
for proto in args:
374+
self.adapters.pop(proto)
375+
371376
def get_adapter(self, url):
372377
try:
373378
return super(Client, self).get_adapter(url)

0 commit comments

Comments
 (0)