Fix bug with panic when DOCKER_CLI_EXPERIMENTAL environment variable is incorrect

Signed-off-by: Daniil Nikolenko <qoo2p5@gmail.com>
This commit is contained in:
Daniil Nikolenko 2020-05-24 23:21:20 +03:00
parent 590f3271ef
commit cb010db830
1 changed files with 8 additions and 1 deletions

View File

@ -144,7 +144,9 @@ func (cli *DockerCli) ServerInfo() ServerInfo {
// ClientInfo returns the client details for the cli
func (cli *DockerCli) ClientInfo() ClientInfo {
if cli.clientInfo == nil {
_ = cli.loadClientInfo()
if err := cli.loadClientInfo(); err != nil {
panic(err)
}
}
return *cli.clientInfo
}
@ -273,6 +275,11 @@ func (cli *DockerCli) Initialize(opts *cliflags.ClientOptions, ops ...Initialize
}
}
cli.initializeFromClient()
if err := cli.loadClientInfo(); err != nil {
return err
}
return nil
}