mirror of https://github.com/docker/compose.git
set current context to default when -H flag is set
Signed-off-by: aiordache <anca.iordache@docker.com>
This commit is contained in:
parent
6f1d88e3bc
commit
f0fd18eec9
11
cli/main.go
11
cli/main.go
|
@ -195,6 +195,10 @@ func main() {
|
||||||
ctx = config.WithDir(ctx, configDir)
|
ctx = config.WithDir(ctx, configDir)
|
||||||
|
|
||||||
currentContext := determineCurrentContext(opts.Context, configDir)
|
currentContext := determineCurrentContext(opts.Context, configDir)
|
||||||
|
if len(opts.Hosts) > 0 {
|
||||||
|
opts.Context = ""
|
||||||
|
currentContext = "default"
|
||||||
|
}
|
||||||
|
|
||||||
s, err := store.New(configDir)
|
s, err := store.New(configDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -213,8 +217,6 @@ func main() {
|
||||||
volume.Command(ctype),
|
volume.Command(ctype),
|
||||||
)
|
)
|
||||||
|
|
||||||
ctx = apicontext.WithCurrentContext(ctx, currentContext)
|
|
||||||
|
|
||||||
cnxOptions := cliflags.CommonOptions{
|
cnxOptions := cliflags.CommonOptions{
|
||||||
Context: opts.Context,
|
Context: opts.Context,
|
||||||
Debug: opts.Debug,
|
Debug: opts.Debug,
|
||||||
|
@ -223,13 +225,12 @@ func main() {
|
||||||
TLS: opts.TLS,
|
TLS: opts.TLS,
|
||||||
TLSVerify: opts.TLSVerify,
|
TLSVerify: opts.TLSVerify,
|
||||||
}
|
}
|
||||||
if len(opts.Hosts) == 0 {
|
|
||||||
cnxOptions.Context = currentContext
|
|
||||||
}
|
|
||||||
if opts.TLSVerify {
|
if opts.TLSVerify {
|
||||||
cnxOptions.TLSOptions = opts.TLSOptions
|
cnxOptions.TLSOptions = opts.TLSOptions
|
||||||
}
|
}
|
||||||
ctx = apicontext.WithCliOptions(ctx, cnxOptions)
|
ctx = apicontext.WithCliOptions(ctx, cnxOptions)
|
||||||
|
ctx = apicontext.WithCurrentContext(ctx, currentContext)
|
||||||
ctx = store.WithContextStore(ctx, s)
|
ctx = store.WithContextStore(ctx, s)
|
||||||
|
|
||||||
if err = root.ExecuteContext(ctx); err != nil {
|
if err = root.ExecuteContext(ctx); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue