image/load: Add --platform

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Paweł Gronowski
2024-08-06 14:48:39 +02:00
committed by Sebastiaan van Stijn
parent a20eb45b26
commit b0bb4ba7f2
5 changed files with 76 additions and 13 deletions

View File

@ -9,10 +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 |
| `-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-->
@ -58,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 `linux/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 variants.
```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
```

View File

@ -9,10 +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 |
| `-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-->