Skip to content
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

docker: update docker-desktop socket check #6395

Merged
merged 1 commit into from
Jun 12, 2024
Merged
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
3 changes: 3 additions & 0 deletions internal/docker/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ func isDefaultHost(e Env) bool {
// Docker Desktop for Mac 4.13+ - socket is in ~/.docker/run/docker.sock
(strings.HasPrefix(host, "unix://") && strings.HasSuffix(host, "/.docker/run/docker.sock")) ||

// Docker Desktop for Windows 4.31+
strings.HasPrefix(host, "npipe:////./pipe/dockerDesktop") ||

// Rancher Desktop without admin access on Linux/Mac is in ~/.rd/docker.sock
(strings.HasPrefix(host, "unix://") && strings.HasSuffix(host, "/.rd/docker.sock"))

Expand Down
26 changes: 25 additions & 1 deletion internal/docker/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,33 @@ func (f *fakeDaemonClient) DaemonHost() string {
return f.host
}

func TestColimaEnv(t *testing.T) {
func TestEnv(t *testing.T) {

table := []EnvTest{
{
product: clusterid.ProductDockerDesktop,
kubecontext: "docker-desktop",
dockerHost: "npipe:////./pipe/dockerDesktopLinuxEngine",
match: true,
},
{
product: clusterid.ProductDockerDesktop,
kubecontext: "docker-desktop",
dockerHost: "npipe:////./pipe/docker_engine",
match: true,
},
{
product: clusterid.ProductDockerDesktop,
kubecontext: "docker-desktop",
dockerHost: "unix:///var/run/docker.sock",
match: true,
},
{
product: clusterid.ProductDockerDesktop,
kubecontext: "docker-desktop",
dockerHost: "unix://~/.docker/desktop/docker.sock",
match: true,
},
{
product: clusterid.ProductColima,
kubecontext: "colima",
Expand Down