-
Notifications
You must be signed in to change notification settings - Fork 18.9k
[WIP] Support OCI image layout in docker save/load #26369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,16 +6,21 @@ import ( | |
|
|
||
| "golang.org/x/net/context" | ||
|
|
||
| "github.com/docker/docker/api/types" | ||
| "github.com/docker/docker/cli" | ||
| "github.com/docker/docker/cli/command" | ||
| "github.com/docker/docker/pkg/jsonmessage" | ||
| "github.com/docker/docker/pkg/system" | ||
| runconfigopts "github.com/docker/docker/runconfig/opts" | ||
| "github.com/spf13/cobra" | ||
| ) | ||
|
|
||
| type loadOptions struct { | ||
| input string | ||
| quiet bool | ||
| oci bool | ||
| name string | ||
| refs []string | ||
| } | ||
|
|
||
| // NewLoadCommand creates a new `docker load` command | ||
|
|
@@ -35,12 +40,13 @@ func NewLoadCommand(dockerCli *command.DockerCli) *cobra.Command { | |
|
|
||
| flags.StringVarP(&opts.input, "input", "i", "", "Read from tar archive file, instead of STDIN") | ||
| flags.BoolVarP(&opts.quiet, "quiet", "q", false, "Suppress the load output") | ||
| flags.StringVarP(&opts.name, "name", "n", "", "Name to use when loading OCI image layout tar archive") | ||
| flags.StringSliceVar(&opts.refs, "ref", []string{}, "References to use when loading an OCI image layout tar archive") | ||
|
||
|
|
||
| return cmd | ||
| } | ||
|
|
||
| func runLoad(dockerCli *command.DockerCli, opts loadOptions) error { | ||
|
|
||
| var input io.Reader = dockerCli.In() | ||
| if opts.input != "" { | ||
| // We use system.OpenSequential to use sequential file access on Windows, avoiding | ||
|
|
@@ -62,7 +68,12 @@ func runLoad(dockerCli *command.DockerCli, opts loadOptions) error { | |
| if !dockerCli.Out().IsTerminal() { | ||
| opts.quiet = true | ||
| } | ||
| response, err := dockerCli.Client().ImageLoad(context.Background(), input, opts.quiet) | ||
| imageLoadOpts := types.ImageLoadOptions{ | ||
| Quiet: opts.quiet, | ||
| Name: opts.name, | ||
| Refs: runconfigopts.ConvertKVStringsToMap(opts.refs), | ||
| } | ||
| response, err := dockerCli.Client().ImageLoad(context.Background(), input, imageLoadOpts) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably best to not have the
-nsupport, only--nameAlso not particularly clear what this does.
I assume the oci image layout can have multiple images?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it does. Please refer to @stevvooe's proposal here #25779