Skip to content

feat: support orbstack socket in addition to docker desktop sockets #3331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion docker/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import sys

from .version import __version__
Expand All @@ -11,7 +12,14 @@
]

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 = {
Expand Down
4 changes: 4 additions & 0 deletions docker/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
DEFAULT_HTTP_HOST,
DEFAULT_NPIPE,
DEFAULT_UNIX_SOCKET,
ORBSTACK_SOCKET,
)
from ..tls import TLSConfig

Expand Down Expand Up @@ -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()
Expand Down