From 2ea2f6cf0fd2edc4b05683e3bb8649fca2bb7ba7 Mon Sep 17 00:00:00 2001 From: Tibor Vass Date: Tue, 19 May 2020 18:09:10 +0000 Subject: [PATCH] Revert "Partially revert cf663b526a34f3e7911e6e60138138c2023aa844 as it breaks the version negotiation with an older docker engine." This reverts commit 7b2fac402fc5d723a7879b8b55e3e48f24a9853c. Signed-off-by: Tibor Vass --- cli/command/cli.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cli/command/cli.go b/cli/command/cli.go index 11db8aaa42dd..962e71cd7276 100644 --- a/cli/command/cli.go +++ b/cli/command/cli.go @@ -9,6 +9,7 @@ import ( "runtime" "strconv" "strings" + "sync" "time" "github.com/docker/cli/cli/config" @@ -139,9 +140,12 @@ func (cli *DockerCli) loadConfigFile() { cli.configFile = cliconfig.LoadDefaultConfigFile(cli.err) } +var fetchServerInfo sync.Once + // ServerInfo returns the server version details for the host this client is // connected to func (cli *DockerCli) ServerInfo() ServerInfo { + fetchServerInfo.Do(cli.initializeFromClient) return cli.serverInfo } @@ -276,7 +280,6 @@ func (cli *DockerCli) Initialize(opts *cliflags.ClientOptions, ops ...Initialize return err } } - cli.initializeFromClient() return nil }