<#7045 fix(flytectl): fall back to Docker Desktop ...
# flyte-github
a
#7045 fix(flytectl): fall back to Docker Desktop socket paths when default is unavailable Pull request opened by themavik Summary On macOS with Docker Desktop, the Docker socket may not be at the default
/var/run/docker.sock
. Docker Desktop places it at
~/.docker/run/docker.sock
or
~/Library/Containers/com.docker.docker/Data/docker-cli.sock
instead. This causes
flytectl demo start
to fail with:
Copy code
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Root Cause
GetDockerClient()
in
docker_util.go
uses
client.NewClientWithOpts(client.FromEnv)
, which defaults to
/var/run/docker.sock
when
DOCKER_HOST
is not set. Docker Desktop for Mac does not always create a symlink at that path. Fix After the initial client creation, if a ping fails and
DOCKER_HOST
is not explicitly set, try well-known Docker Desktop socket paths: 1.
~/.docker/run/docker.sock
(Docker Desktop default on macOS and Linux) 2.
~/Library/Containers/com.docker.docker/Data/docker-cli.sock
(macOS-specific) For each candidate, check if the socket file exists, create a client, and verify with a ping. Use the first working socket. If none work, return the original client (preserving the existing error behavior). Testing • Existing behavior unchanged when
/var/run/docker.sock
works or
DOCKER_HOST
is set • On macOS Docker Desktop without the default symlink, the fallback finds the correct socket • Socket paths are only tried when the initial connection fails (no performance impact on working setups) Closes #6138 flyteorg/flyte