Skip to content

Commit 357388c

Browse files
committed
feat: support orbstack socket in addition to docker desktop sockets
1 parent db7f8b8 commit 357388c

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

docker/constants.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import sys
23

34
from .version import __version__
@@ -11,7 +12,14 @@
1112
]
1213

1314
DEFAULT_HTTP_HOST = "127.0.0.1"
14-
DEFAULT_UNIX_SOCKET = "http+unix:///var/run/docker.sock"
15+
16+
# Check for OrbStack socket first, fall back to standard Docker socket
17+
ORBSTACK_SOCKET = os.path.expanduser("~/.orbstack/run/docker.sock")
18+
if os.path.exists(ORBSTACK_SOCKET):
19+
DEFAULT_UNIX_SOCKET = f"http+unix://{ORBSTACK_SOCKET}"
20+
else:
21+
DEFAULT_UNIX_SOCKET = "http+unix:///var/run/docker.sock"
22+
1523
DEFAULT_NPIPE = 'npipe:////./pipe/docker_engine'
1624

1725
BYTE_UNITS = {

docker/utils/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
DEFAULT_HTTP_HOST,
1717
DEFAULT_NPIPE,
1818
DEFAULT_UNIX_SOCKET,
19+
ORBSTACK_SOCKET,
1920
)
2021
from ..tls import TLSConfig
2122

@@ -235,6 +236,9 @@ def parse_host(addr, is_win32=False, tls=False):
235236
if not addr and is_win32:
236237
return DEFAULT_NPIPE
237238
if not addr or addr.strip() == 'unix://':
239+
# If OrbStack socket exists, use it
240+
if os.path.exists(ORBSTACK_SOCKET):
241+
return f"http+unix://{ORBSTACK_SOCKET}"
238242
return DEFAULT_UNIX_SOCKET
239243

240244
addr = addr.strip()

0 commit comments

Comments
 (0)