From 416b6273bfbab80baf18e4e05bdc5b13c8284161 Mon Sep 17 00:00:00 2001 From: Nick Santos Date: Wed, 12 Jun 2024 13:21:03 -0400 Subject: [PATCH] docker: update docker-desktop socket check fixes https://github.com/tilt-dev/tilt/issues/6394 Signed-off-by: Nick Santos --- internal/docker/env.go | 3 +++ internal/docker/env_test.go | 26 +++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/internal/docker/env.go b/internal/docker/env.go index 632c31f241..14d0be15a4 100644 --- a/internal/docker/env.go +++ b/internal/docker/env.go @@ -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")) diff --git a/internal/docker/env_test.go b/internal/docker/env_test.go index cdf9ac652c..1ae901faa2 100644 --- a/internal/docker/env_test.go +++ b/internal/docker/env_test.go @@ -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",