This commit is contained in:
Michael Bianco 2025-04-19 14:44:41 +00:00 committed by GitHub
commit d176f561d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,4 @@
import os
import sys
from .version import __version__
@ -11,7 +12,14 @@ CONTAINER_LIMITS_KEYS = [
]
DEFAULT_HTTP_HOST = "127.0.0.1"
DEFAULT_UNIX_SOCKET = "http+unix:///var/run/docker.sock"
# 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_NPIPE = 'npipe:////./pipe/docker_engine'
BYTE_UNITS = {

View File

@ -16,6 +16,7 @@ from ..constants import (
DEFAULT_HTTP_HOST,
DEFAULT_NPIPE,
DEFAULT_UNIX_SOCKET,
ORBSTACK_SOCKET,
)
from ..tls import TLSConfig
@ -235,6 +236,9 @@ def parse_host(addr, is_win32=False, tls=False):
if not addr and is_win32:
return DEFAULT_NPIPE
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
addr = addr.strip()