Skip to content

Commit

Permalink
image-load: rewrite flag-description, move to docs
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
thaJeztah committed Oct 7, 2024
1 parent 28282d6 commit 7731583
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 16 deletions.
7 changes: 1 addition & 6 deletions cli/command/image/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,7 @@ func NewLoadCommand(dockerCli command.Cli) *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.StringVar(&opts.platform, "platform", "",
`Specify a platform from a multi-platform image to load.
If a platform is not specified, and the image is a multi-platform image, all platforms are loaded.
Format: "os[/arch[/variant]]"
Example: "docker image load --platform linux/amd64"`)
flags.StringVar(&opts.platform, "platform", "", `Load only the given platform variant. Formatted as "os[/arch[/variant]]" (e.g. "linux/amd64")`)
_ = flags.SetAnnotation("platform", "version", []string{"1.48"})

return cmd
Expand Down
39 changes: 34 additions & 5 deletions docs/reference/commandline/image_load.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ Load an image from a tar archive or STDIN

### Options

| Name | Type | Default | Description |
|:------------------------------------|:---------|:--------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`-i`](#input), [`--input`](#input) | `string` | | Read from tar archive file, instead of STDIN |
| `--platform` | `string` | | Specify a platform from a multi-platform image to load.<br>If a platform is not specified, and the image is a multi-platform image, all platforms are loaded.<br><br>Format: `os[/arch[/variant]]`<br>Example: `docker image load --platform linux/amd64` |
| `-q`, `--quiet` | `bool` | | Suppress the load output |
| Name | Type | Default | Description |
|:------------------------------------|:---------|:--------|:----------------------------------------------------------------------------------------------|
| [`-i`](#input), [`--input`](#input) | `string` | | Read from tar archive file, instead of STDIN |
| [`--platform`](#platform) | `string` | | Load only the given platform variant. Formatted as `os[/arch[/variant]]` (e.g. `linux/amd64`) |
| `-q`, `--quiet` | `bool` | | Suppress the load output |


<!---MARKER_GEN_END-->
Expand Down Expand Up @@ -59,3 +59,32 @@ fedora 20 58394af37342 7 weeks ago
fedora heisenbug 58394af37342 7 weeks ago 385.5 MB
fedora latest 58394af37342 7 weeks ago 385.5 MB
```


### <a name="platform"></a> Load a specific platform (--platform)

The `--platform` option allows you to specify which platform-variant of the
image to load. By default, `docker load` loads all platform variants that
are present in the archive. Use the `--platform` option to specify which
platform variant of the image to load. An error is produced if the given
platform is not present in the archive.

The platform option takes the `os[/arch[/variant]]` format, for example,
`linux/amd64` or `limux/arm64/v8`. Architecture and variant are optional,
and default to the daemon's native architecture if omitted.

The following example loads the `linux/amd64` variant of an `alpine` image
from an archive that contains multiple platform variabts.

```console
$ docker image load -i image.tar --platform=linux/amd64
Loaded image: alpine:latest
```

The following example attempts to load a `linux/ppc64le` image from an
archive, but the given platform is not present in the archive;

```console
$ docker image load -i image.tar --platform=linux/ppc64le
requested platform (linux/ppc64le) not found: image might be filtered out
```
10 changes: 5 additions & 5 deletions docs/reference/commandline/load.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ Load an image from a tar archive or STDIN

### Options

| Name | Type | Default | Description |
|:----------------|:---------|:--------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `-i`, `--input` | `string` | | Read from tar archive file, instead of STDIN |
| `--platform` | `string` | | Specify a platform from a multi-platform image to load.<br>If a platform is not specified, and the image is a multi-platform image, all platforms are loaded.<br><br>Format: `os[/arch[/variant]]`<br>Example: `docker image load --platform linux/amd64` |
| `-q`, `--quiet` | `bool` | | Suppress the load output |
| Name | Type | Default | Description |
|:----------------|:---------|:--------|:----------------------------------------------------------------------------------------------|
| `-i`, `--input` | `string` | | Read from tar archive file, instead of STDIN |
| `--platform` | `string` | | Load only the given platform variant. Formatted as `os[/arch[/variant]]` (e.g. `linux/amd64`) |
| `-q`, `--quiet` | `bool` | | Suppress the load output |


<!---MARKER_GEN_END-->
Expand Down

0 comments on commit 7731583

Please sign in to comment.