From cd68c8f003861fc71bb81e8c07d424d3ccfc37ac Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 30 Jun 2023 14:58:40 +0200 Subject: [PATCH] docker info: fix condition for printing debug information The daemon collects this information regardless if "debug" is enabled. Print the debugging information if either the daemon, or the client has debug enabled. We should probably improve this logic and print any of these if set (but some special rules are needed for file-descriptors, which may use "-1". Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 92d7a234dd26f03972a9137c2e65f943acf43c7a) Signed-off-by: Sebastiaan van Stijn --- cli/command/system/info.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cli/command/system/info.go b/cli/command/system/info.go index 153c968bd2..cef7dc9856 100644 --- a/cli/command/system/info.go +++ b/cli/command/system/info.go @@ -313,7 +313,12 @@ func prettyPrintServerInfo(streams command.Streams, info *info) []error { fprintln(output, " Docker Root Dir:", info.DockerRootDir) fprintln(output, " Debug Mode:", info.Debug) - if info.Debug { + // The daemon collects this information regardless if "debug" is + // enabled. Print the debugging information if either the daemon, + // or the client has debug enabled. We should probably improve this + // logic and print any of these if set (but some special rules are + // needed for file-descriptors, which may use "-1". + if info.Debug || debug.IsEnabled() { fprintln(output, " File Descriptors:", info.NFd) fprintln(output, " Goroutines:", info.NGoroutines) fprintln(output, " System Time:", info.SystemTime)