Skip to content
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ require (
go.opentelemetry.io/otel/sdk v1.37.0
go.opentelemetry.io/otel/sdk/metric v1.37.0
go.uber.org/mock v0.5.2
golang.ngrok.com/ngrok/v2 v2.0.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change still needed?

golang.org/x/exp/jsonrpc2 v0.0.0-20250718183923-645b1fa84792
golang.org/x/mod v0.27.0
golang.org/x/oauth2 v0.30.0
Expand Down Expand Up @@ -238,7 +239,6 @@ require (
go.uber.org/zap v1.27.0 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
golang.ngrok.com/muxado/v2 v2.0.1 // indirect
golang.ngrok.com/ngrok/v2 v2.0.0 // indirect
golang.org/x/exp/event v0.0.0-20250620022241-b7579e27df2b // indirect
golang.org/x/net v0.42.0 // indirect
golang.org/x/text v0.27.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/vault/api v1.16.0 h1:nbEYGJiAPGzT9U4oWgaaB0g+Rj8E59QuHKyA5LhwQN4=
github.com/hashicorp/vault/api v1.16.0/go.mod h1:KhuUhzOD8lDSk29AtzNjgAu2kxRA9jL9NAbkFlqvkBA=
github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE=
github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
github.com/howeyc/gopass v0.0.0-20210920133722-c8aef6fb66ef h1:A9HsByNhogrvm9cWb28sjiS3i7tcKCkflWFEkHfuAgM=
github.com/howeyc/gopass v0.0.0-20210920133722-c8aef6fb66ef/go.mod h1:lADxMC39cJJqL93Duh1xhAs4I2Zs8mKS89XWXFGp9cs=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
Expand Down
22 changes: 22 additions & 0 deletions pkg/container/docker/sdk/client_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ func findPlatformContainerSocket(rt runtime.Type) (string, runtime.Type, error)
return customSocketPath, runtime.TypeDocker, nil
}

if customSocketPath := os.Getenv(ColimaSocketEnv); customSocketPath != "" {
logger.Debugf("Using Colima socket from env: %s", customSocketPath)
// validate the socket path
if _, err := os.Stat(customSocketPath); err != nil {
return "", runtime.TypeDocker, fmt.Errorf("invalid Colima socket path: %w", err)
}
return customSocketPath, runtime.TypeDocker, nil
}

if rt == runtime.TypePodman {
socketPath, err := findPodmanSocket()
if err == nil {
Expand Down Expand Up @@ -157,5 +166,18 @@ func findDockerSocket() (string, error) {
logger.Debugf("Failed to check Rancher Desktop socket at %s: %v", rancherDesktopPath, err)
}

// Try Rancher Desktop socket path on macOS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Suggested change
// Try Rancher Desktop socket path on macOS
// Try Colima socket path on macOS

if home := os.Getenv("HOME"); home != "" {
userSocketPath := filepath.Join(home, ColimaDesktopMacSocketPath)
_, err := os.Stat(userSocketPath)

if err == nil {
logger.Debugf("Found Colima socket at %s", userSocketPath)
return userSocketPath, nil
}

logger.Debugf("Failed to check Colima socket at %s: %v", userSocketPath, err)
}

return "", fmt.Errorf("docker socket not found in standard locations")
}
4 changes: 4 additions & 0 deletions pkg/container/docker/sdk/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const (
DockerSocketEnv = "TOOLHIVE_DOCKER_SOCKET"
// PodmanSocketEnv is the environment variable for custom Podman socket path
PodmanSocketEnv = "TOOLHIVE_PODMAN_SOCKET"
// ColimaSocketEnv is the environment variable for custom Colima socket path
ColimaSocketEnv = "TOOLHIVE_COLIMA_SOCKET"
)

// Common socket paths
Expand All @@ -36,6 +38,8 @@ const (
DockerDesktopMacSocketPath = ".docker/run/docker.sock"
// RancherDesktopMacSocketPath is the Docker socket path for Rancher Desktop on macOS
RancherDesktopMacSocketPath = ".rd/docker.sock"
// ColimaDesktopMacSocketPath is the Docker socket path for Colima on macOS
ColimaDesktopMacSocketPath = ".colima/default/docker.sock"
)

var supportedSocketPaths = []runtime.Type{runtime.TypePodman, runtime.TypeDocker}
Expand Down