Skip to content

Commit b5f5e27

Browse files
committed
don't use unitialized cli to setup DryRunClient
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent b1334b8 commit b5f5e27

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

pkg/api/dryrunclient.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ type execDetails struct {
7070
}
7171

7272
// NewDryRunClient produces a DryRunClient
73-
func NewDryRunClient(apiClient client.APIClient, cli *command.DockerCli) (*DryRunClient, error) {
73+
func NewDryRunClient(apiClient client.APIClient, cli command.Cli) (*DryRunClient, error) {
7474
b, err := builder.New(cli, builder.WithSkippedValidation())
7575
if err != nil {
7676
return nil, err

pkg/compose/compose.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,11 @@ func (s *composeService) DryRunMode(ctx context.Context, dryRun bool) (context.C
8888
if err != nil {
8989
return ctx, err
9090
}
91-
err = cli.Initialize(flags.NewClientOptions(), command.WithInitializeClient(func(cli *command.DockerCli) (client.APIClient, error) {
92-
return api.NewDryRunClient(s.apiClient(), cli)
91+
92+
options := flags.NewClientOptions()
93+
options.Context = s.dockerCli.CurrentContext()
94+
err = cli.Initialize(options, command.WithInitializeClient(func(cli *command.DockerCli) (client.APIClient, error) {
95+
return api.NewDryRunClient(s.apiClient(), s.dockerCli)
9396
}))
9497
if err != nil {
9598
return ctx, err

0 commit comments

Comments
 (0)