docker / docker/cli

`DOCKER_HOST` without `unix://` prefix prints a confusing error: `Cannot connect to the Docker daemon at tcp://localhost:2375/foo.sock.`

Open
#5,846 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/ux exp/beginner kind/enhancement version/27.5
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

Description
$ DOCKER_HOST=/invalid.sock docker version
Client:
 Version:           27.5.1
 API version:       1.47
 Go version:        go1.22.11
 Git commit:        9f9e405
 Built:             Wed Jan 22 13:39:08 2025
 OS/Arch:           linux/arm64
 Context:           default
Cannot connect to the Docker daemon at tcp://localhost:2375/invalid.sock. Is the docker daemon running?

This error message is quite confusing, as the original invalid DOCKER_HOST value does not contain tcp://localhost:2375.
Probably it should return an error like invalid $DOCKER_HOST value "/invalid.sock": must start with "unix://" or "tcp://"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with DOCKER_HOST=/invalid.sock docker version and trace the Docker CLI entry point that parses DOCKER_HOST. The change is done when an invalid value reports the original value and explains the required unix:// or tcp:// prefix, with the relevant CLI tests passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.