Skip to content

Commit

Permalink
Improve Docker Desktop detection
Browse files Browse the repository at this point in the history
During some experiments I noticed that when setting DOCKER_HOST, `docker
info` no longer reports the context as `desktop-linux`. Looking for
"Docker Desktop" as the docker server operating system seems more
reliable.

I am keeping the `desktop-linux` filter as a fallback nevertheless.

Improves #37242
  • Loading branch information
zakkak committed Nov 28, 2023
1 parent 3f87117 commit 5336193
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ private static boolean getRootlessStateFor(ContainerRuntime containerRuntime) {
// We also treat Docker Desktop as "rootless" since the way it binds mounts does not
// transparently map the host user ID and GID
// see https://docs.docker.com/desktop/faqs/linuxfaqs/#how-do-i-enable-file-sharing
stringPredicate = line -> line.trim().equals("rootless") || line.contains("desktop-linux");
stringPredicate = line -> line.trim().equals("rootless") || line.contains("Docker Desktop")
|| line.contains("desktop-linux");
} else {
stringPredicate = line -> line.trim().equals("rootless: true");
}
Expand Down

0 comments on commit 5336193

Please sign in to comment.