diff --git a/cli/command/image/client_test.go b/cli/command/image/client_test.go index 4e14bcf7abeb..a2aa4a988106 100644 --- a/cli/command/image/client_test.go +++ b/cli/command/image/client_test.go @@ -16,7 +16,7 @@ import ( type fakeClient struct { client.Client imageTagFunc func(string, string) error - imageSaveFunc func(images []string) (io.ReadCloser, error) + imageSaveFunc func(images []string, _ ...image.SaveOptions) (io.ReadCloser, error) imageRemoveFunc func(image string, options image.RemoveOptions) ([]image.DeleteResponse, error) imagePushFunc func(ref string, options image.PushOptions) (io.ReadCloser, error) infoFunc func() (system.Info, error) @@ -26,7 +26,7 @@ type fakeClient struct { imageListFunc func(options image.ListOptions) ([]image.Summary, error) imageInspectFunc func(img string) (image.InspectResponse, []byte, error) imageImportFunc func(source image.ImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) - imageHistoryFunc func(img string) ([]image.HistoryResponseItem, error) + imageHistoryFunc func(img string, options ...image.HistoryOptions) ([]image.HistoryResponseItem, error) imageBuildFunc func(context.Context, io.Reader, types.ImageBuildOptions) (types.ImageBuildResponse, error) } diff --git a/cli/command/image/history.go b/cli/command/image/history.go index 1c0ae409811a..73a893fa976c 100644 --- a/cli/command/image/history.go +++ b/cli/command/image/history.go @@ -8,6 +8,7 @@ import ( "github.com/docker/cli/cli/command/completion" "github.com/docker/cli/cli/command/formatter" flagsHelper "github.com/docker/cli/cli/flags" + "github.com/docker/docker/api/types/image" "github.com/spf13/cobra" ) @@ -49,7 +50,7 @@ func NewHistoryCommand(dockerCli command.Cli) *cobra.Command { } func runHistory(ctx context.Context, dockerCli command.Cli, opts historyOptions) error { - history, err := dockerCli.Client().ImageHistory(ctx, opts.image) + history, err := dockerCli.Client().ImageHistory(ctx, opts.image, image.HistoryOptions{}) if err != nil { return err } diff --git a/cli/command/image/load.go b/cli/command/image/load.go index b11303d90ce9..ecb815b2b17f 100644 --- a/cli/command/image/load.go +++ b/cli/command/image/load.go @@ -7,6 +7,7 @@ import ( "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" "github.com/docker/cli/cli/command/completion" + "github.com/docker/docker/api/types/image" "github.com/docker/docker/pkg/jsonmessage" "github.com/moby/sys/sequential" "github.com/pkg/errors" @@ -62,10 +63,11 @@ func runLoad(ctx context.Context, dockerCli command.Cli, opts loadOptions) error return errors.Errorf("requested load from stdin, but stdin is empty") } - if !dockerCli.Out().IsTerminal() { - opts.quiet = true + var loadOpts image.LoadOptions + if opts.quiet || !dockerCli.Out().IsTerminal() { + loadOpts.Quiet = true } - response, err := dockerCli.Client().ImageLoad(ctx, input, opts.quiet) + response, err := dockerCli.Client().ImageLoad(ctx, input, image.LoadOptions{Quiet: opts.quiet}) if err != nil { return err } diff --git a/cli/command/image/save.go b/cli/command/image/save.go index 40cdf68ee104..c5a32859b831 100644 --- a/cli/command/image/save.go +++ b/cli/command/image/save.go @@ -7,6 +7,7 @@ import ( "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" "github.com/docker/cli/cli/command/completion" + "github.com/docker/docker/api/types/image" "github.com/pkg/errors" "github.com/spf13/cobra" ) @@ -51,7 +52,7 @@ func RunSave(ctx context.Context, dockerCli command.Cli, opts saveOptions) error return errors.Wrap(err, "failed to save image") } - responseBody, err := dockerCli.Client().ImageSave(ctx, opts.images) + responseBody, err := dockerCli.Client().ImageSave(ctx, opts.images, image.SaveOptions{}) if err != nil { return err }