Always initialize context store

Signed-off-by: Jean-Christophe Sirot <jean-christophe.sirot@docker.com>
This commit is contained in:
Jean-Christophe Sirot 2019-02-25 17:35:53 +01:00
parent d6a230606c
commit 3b26cfce8b
1 changed files with 6 additions and 5 deletions

View File

@ -209,12 +209,13 @@ func (cli *DockerCli) Initialize(opts *cliflags.ClientOptions, ops ...Initialize
cli.configFile = cliconfig.LoadDefaultConfigFile(cli.err) cli.configFile = cliconfig.LoadDefaultConfigFile(cli.err)
if cli.client == nil {
cli.contextStore = store.New(cliconfig.ContextStoreDir(), cli.contextStoreConfig) cli.contextStore = store.New(cliconfig.ContextStoreDir(), cli.contextStoreConfig)
cli.currentContext, err = resolveContextName(opts.Common, cli.configFile, cli.contextStore) cli.currentContext, err = resolveContextName(opts.Common, cli.configFile, cli.contextStore)
if err != nil { if err != nil {
return err return err
} }
if cli.client == nil {
endpoint, err := resolveDockerEndpoint(cli.contextStore, cli.currentContext, opts.Common) endpoint, err := resolveDockerEndpoint(cli.contextStore, cli.currentContext, opts.Common)
if err != nil { if err != nil {
return errors.Wrap(err, "unable to resolve docker endpoint") return errors.Wrap(err, "unable to resolve docker endpoint")