diff --git a/pkg/api/dryrunclient.go b/pkg/api/dryrunclient.go index 13d18761d..c5926be83 100644 --- a/pkg/api/dryrunclient.go +++ b/pkg/api/dryrunclient.go @@ -70,7 +70,7 @@ type execDetails struct { } // NewDryRunClient produces a DryRunClient -func NewDryRunClient(apiClient client.APIClient, cli *command.DockerCli) (*DryRunClient, error) { +func NewDryRunClient(apiClient client.APIClient, cli command.Cli) (*DryRunClient, error) { b, err := builder.New(cli, builder.WithSkippedValidation()) if err != nil { return nil, err diff --git a/pkg/compose/compose.go b/pkg/compose/compose.go index 9f9c564f7..3d6835c0a 100644 --- a/pkg/compose/compose.go +++ b/pkg/compose/compose.go @@ -88,8 +88,11 @@ func (s *composeService) DryRunMode(ctx context.Context, dryRun bool) (context.C if err != nil { return ctx, err } - err = cli.Initialize(flags.NewClientOptions(), command.WithInitializeClient(func(cli *command.DockerCli) (client.APIClient, error) { - return api.NewDryRunClient(s.apiClient(), cli) + + options := flags.NewClientOptions() + options.Context = s.dockerCli.CurrentContext() + err = cli.Initialize(options, command.WithInitializeClient(func(cli *command.DockerCli) (client.APIClient, error) { + return api.NewDryRunClient(s.apiClient(), s.dockerCli) })) if err != nil { return ctx, err