docker / docker/cli

`DaemonHost()` returns `http://docker.example.com` for ssh transport

Open
#6,164 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug status/0-triage
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

Description

cli.DaemonHost() gives http://docker.example.com when docker host is set to ssh

the behavior comes from getConnectionHelper in https://github.com/docker/cli/blob/84038691220e7ba3329a177e4e3357b4ee0e3a52/cli/connhelper/connhelper.go#L64 the Host is set to http://docker.example.com in connection helper and later updated the host attribute in the cli.Client at https://github.com/docker/cli/blob/84038691220e7ba3329a177e4e3357b4ee0e3a52/cli/context/docker/load.go#L115

the daemon host is specially useful in docker compose when we want to know if the docker host it's remote or not, like you are doing here https://github.com/docker/cli/blob/84038691220e7ba3329a177e4e3357b4ee0e3a52/cli/context/docker/load.go#L127

Reproduce
DOCKER_HOST="ssh://user@1.2.3.4" docker 
Expected behavior

we should be able to know whenever the docker cli is accessing the docker host via ssh, unix, pipe, etc

basically we should be able to access docker host used

docker version
Client: Docker Engine - Community
 Version:           28.2.2
 API version:       1.50
 Go version:        go1.24.3
 Git commit:        e6534b4
 Built:             Fri May 30 12:07:26 2025
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          28.2.2
  API version:      1.50 (minimum version 1.24)
  Go version:       go1.24.3
  Git commit:       45873be
  Built:            Fri May 30 12:07:26 2025
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.27
  GitCommit:        05044ec0a9a75232cad458027ca83437aae3f4da
 runc:
  Version:          1.2.5
  GitCommit:        v1.2.5-0-g59923ef
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
docker info
Client: Docker Engine - Community
 Version:    28.2.2
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.24.0
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.36.2
    Path:     /usr/libexec/docker/cli-plugins/docker-compose
Additional Info

No response

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

Start with getConnectionHelper in cli/connhelper/connhelper.go and the client host handling in cli/context/docker/load.go. Reproduce the behavior with DOCKER_HOST="ssh://user@1.2.3.4" and trace how DaemonHost() is derived. Done means the CLI exposes the actual configured transport, including ssh, unix, and pipe, so callers can distinguish remote from local hosts.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.