mirror of https://github.com/docker/docker-py.git
Merge 357388ca5c
into db7f8b8bb6
This commit is contained in:
commit
d176f561d9
|
@ -1,3 +1,4 @@
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from .version import __version__
|
from .version import __version__
|
||||||
|
@ -11,7 +12,14 @@ CONTAINER_LIMITS_KEYS = [
|
||||||
]
|
]
|
||||||
|
|
||||||
DEFAULT_HTTP_HOST = "127.0.0.1"
|
DEFAULT_HTTP_HOST = "127.0.0.1"
|
||||||
|
|
||||||
|
# Check for OrbStack socket first, fall back to standard Docker socket
|
||||||
|
ORBSTACK_SOCKET = os.path.expanduser("~/.orbstack/run/docker.sock")
|
||||||
|
if os.path.exists(ORBSTACK_SOCKET):
|
||||||
|
DEFAULT_UNIX_SOCKET = f"http+unix://{ORBSTACK_SOCKET}"
|
||||||
|
else:
|
||||||
DEFAULT_UNIX_SOCKET = "http+unix:///var/run/docker.sock"
|
DEFAULT_UNIX_SOCKET = "http+unix:///var/run/docker.sock"
|
||||||
|
|
||||||
DEFAULT_NPIPE = 'npipe:////./pipe/docker_engine'
|
DEFAULT_NPIPE = 'npipe:////./pipe/docker_engine'
|
||||||
|
|
||||||
BYTE_UNITS = {
|
BYTE_UNITS = {
|
||||||
|
|
|
@ -16,6 +16,7 @@ from ..constants import (
|
||||||
DEFAULT_HTTP_HOST,
|
DEFAULT_HTTP_HOST,
|
||||||
DEFAULT_NPIPE,
|
DEFAULT_NPIPE,
|
||||||
DEFAULT_UNIX_SOCKET,
|
DEFAULT_UNIX_SOCKET,
|
||||||
|
ORBSTACK_SOCKET,
|
||||||
)
|
)
|
||||||
from ..tls import TLSConfig
|
from ..tls import TLSConfig
|
||||||
|
|
||||||
|
@ -235,6 +236,9 @@ def parse_host(addr, is_win32=False, tls=False):
|
||||||
if not addr and is_win32:
|
if not addr and is_win32:
|
||||||
return DEFAULT_NPIPE
|
return DEFAULT_NPIPE
|
||||||
if not addr or addr.strip() == 'unix://':
|
if not addr or addr.strip() == 'unix://':
|
||||||
|
# If OrbStack socket exists, use it
|
||||||
|
if os.path.exists(ORBSTACK_SOCKET):
|
||||||
|
return f"http+unix://{ORBSTACK_SOCKET}"
|
||||||
return DEFAULT_UNIX_SOCKET
|
return DEFAULT_UNIX_SOCKET
|
||||||
|
|
||||||
addr = addr.strip()
|
addr = addr.strip()
|
||||||
|
|
Loading…
Reference in New Issue