Skip to content

Commit 02b4533

Browse files
authored
Merge pull request moby#39588 from zappy-shu/DESKTOP-1286-win-admin-error-readability
Improve readability of Windows connect error
2 parents d2ec6d0 + 1a5dafb commit 02b4533

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

client/request.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,13 @@ func (cli *Client) doRequest(ctx context.Context, req *http.Request) (serverResp
178178
// this is localised - for example in French the error would be
179179
// `open //./pipe/docker_engine: Le fichier spécifié est introuvable.`
180180
if strings.Contains(err.Error(), `open //./pipe/docker_engine`) {
181-
err = errors.New(err.Error() + " In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.")
181+
// Checks if client is running with elevated privileges
182+
if f, elevatedErr := os.Open("\\\\.\\PHYSICALDRIVE0"); elevatedErr == nil {
183+
err = errors.Wrap(err, "In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.")
184+
} else {
185+
f.Close()
186+
err = errors.Wrap(err, "This error may indicate that the docker daemon is not running.")
187+
}
182188
}
183189

184190
return serverResp, errors.Wrap(err, "error during connect")

0 commit comments

Comments
 (0)