Signed-off-by: aiordache <anca.iordache@docker.com>
This commit is contained in:
aiordache 2021-03-05 14:29:42 +01:00
parent f0fd18eec9
commit 6458b97089
3 changed files with 19 additions and 30 deletions

View file

@ -195,10 +195,6 @@ func main() {
ctx = config.WithDir(ctx, configDir)
currentContext := determineCurrentContext(opts.Context, configDir)
if len(opts.Hosts) > 0 {
opts.Context = ""
currentContext = "default"
}
s, err := store.New(configDir)
if err != nil {
@ -216,20 +212,26 @@ func main() {
compose.Command(ctype),
volume.Command(ctype),
)
if ctype == store.LocalContextType {
if len(opts.Hosts) > 0 {
opts.Context = ""
currentContext = "default"
}
cnxOptions := cliflags.CommonOptions{
Context: opts.Context,
Debug: opts.Debug,
Hosts: opts.Hosts,
LogLevel: opts.LogLevel,
TLS: opts.TLS,
TLSVerify: opts.TLSVerify,
}
cnxOptions := cliflags.CommonOptions{
Context: opts.Context,
Debug: opts.Debug,
Hosts: opts.Hosts,
LogLevel: opts.LogLevel,
TLS: opts.TLS,
TLSVerify: opts.TLSVerify,
}
if opts.TLSVerify {
cnxOptions.TLSOptions = opts.TLSOptions
if opts.TLSVerify {
cnxOptions.TLSOptions = opts.TLSOptions
}
ctx = apicontext.WithCliOptions(ctx, cnxOptions)
}
ctx = apicontext.WithCliOptions(ctx, cnxOptions)
ctx = apicontext.WithCurrentContext(ctx, currentContext)
ctx = store.WithContextStore(ctx, s)