From 37f7579691aa7f7c7cba45fafb0afc548e17c4bf Mon Sep 17 00:00:00 2001 From: Aaron Date: Thu, 18 Jun 2026 13:44:47 +0000 Subject: [PATCH 1/2] fix: use HumanSize for image list to avoid scientific notation The Size() method in the image formatter used HumanSizeWithPrecision with precision=3, which causes fmt %g to emit scientific notation (1e+03MB) when a size rounds to exactly 1000 in its current unit (e.g. an image of ~999.5 MB). Switch to HumanSize() which uses precision=4 (the standard across the rest of the CLI) and avoids this edge case while still producing compact human-readable output. Fixes #3091 Signed-off-by: Aaron --- cli/command/formatter/image.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/command/formatter/image.go b/cli/command/formatter/image.go index d24bf50947ce..6182fe027c1c 100644 --- a/cli/command/formatter/image.go +++ b/cli/command/formatter/image.go @@ -246,7 +246,7 @@ func (c *imageContext) CreatedAt() string { } func (c *imageContext) Size() string { - return units.HumanSizeWithPrecision(float64(c.i.Size), 3) + return units.HumanSize(float64(c.i.Size)) } func (c *imageContext) Containers() string { From 0d1bf0cf26c980e90be10402b3b9ff54eccd721e Mon Sep 17 00:00:00 2001 From: Aaron Date: Thu, 18 Jun 2026 14:14:06 +0000 Subject: [PATCH 2/2] fix: default to unix scheme when DOCKER_HOST is a path When DOCKER_HOST is set to a filesystem path without a scheme (e.g. /var/run/docker.sock), parseDockerDaemonHost previously defaulted to the "tcp" protocol, producing a confusing error: "Cannot connect to the Docker daemon at tcp://localhost:2375/foo.sock" Now, if the address starts with "/" or "./", the parser defaults to "unix" instead of "tcp", which matches the user's intent and produces a correct connection or a clear error. Fixes #5846 Signed-off-by: Aaron --- opts/hosts.go | 9 ++++++++- opts/hosts_test.go | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/opts/hosts.go b/opts/hosts.go index dcbbb7e78166..26624d1e2c45 100644 --- a/opts/hosts.go +++ b/opts/hosts.go @@ -57,7 +57,14 @@ func parseDockerDaemonHost(addr string) (string, error) { proto, host, hasProto := strings.Cut(addr, "://") if !hasProto && proto != "" { host = proto - proto = "tcp" + // If the address looks like a filesystem path, default to "unix" + // rather than "tcp" to avoid confusing errors when the user sets + // DOCKER_HOST=/path/to/sock without a unix:// prefix. + if strings.HasPrefix(host, "/") || strings.HasPrefix(host, "./") { + proto = "unix" + } else { + proto = "tcp" + } } switch proto { diff --git a/opts/hosts_test.go b/opts/hosts_test.go index 28f4eb6fab9e..36eff9a2d8de 100644 --- a/opts/hosts_test.go +++ b/opts/hosts_test.go @@ -79,6 +79,8 @@ func TestParseDockerDaemonHost(t *testing.T) { "unix://": "unix://" + defaultUnixSocket, "fd://": "fd://", "fd://something": "fd://something", + "/var/run/docker.sock": "unix:///var/run/docker.sock", + "./run/docker.sock": "unix://run/docker.sock", "localhost:": "tcp://localhost:2375", "localhost:5555": "tcp://localhost:5555", "localhost:5555/path": "tcp://localhost:5555/path",