Skip to content

Commit 763ae3e

Browse files
committed
docs: import: update documentation for --platform
The `--platform` flag originally was added for the experimental LCOW feature and only accepted the target operating system. Current versions of Docker allow passing both OS and Architecture, so updating the documentation to reflect this. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 2a67d60 commit 763ae3e

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

docs/reference/commandline/image_import.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Import the contents from a tarball to create a filesystem image
1313
|:------------------------------------------|:---------|:--------|:--------------------------------------------------|
1414
| [`-c`](#change), [`--change`](#change) | `list` | | Apply Dockerfile instruction to the created image |
1515
| [`-m`](#message), [`--message`](#message) | `string` | | Set commit message for imported image |
16-
| `--platform` | `string` | | Set platform if server is multi-platform capable |
16+
| [`--platform`](#platform) | `string` | | Set platform if server is multi-platform capable |
1717

1818

1919
<!---MARKER_GEN_END-->
@@ -120,3 +120,31 @@ daemon.
120120
```console
121121
$ docker import --platform=linux .\linuximage.tar
122122
```
123+
124+
### <a name="platform"></a> Set the platform for the imported image (--platform)
125+
126+
The `--platform` option allows you to specify the platform for the imported
127+
image. By default, the daemon's native platform is used as platform, but
128+
the `--platform` option allows you to override the default, for example, in
129+
situations where the imported root filesystem is for a different architecture
130+
or operating system.
131+
132+
The platform option takes the `os[/arch[/variant]]` format; for example,
133+
`linux/amd64` or `linux/arm64/v8`. Architecture and variant are optional,
134+
and default to the daemon's native architecture if omitted.
135+
136+
The following example imports an image from a root-filesystem in `rootfs.tgz`,
137+
and sets the image's platform to `linux/amd64`;
138+
139+
```console
140+
$ docker image import --platform=linux/amd64 ./rootfs.tgz imported:latest
141+
sha256:44a8b44157dad5edcff85f0c93a3e455f3b20a046d025af4ec50ed990d7ebc09
142+
```
143+
144+
After importing the image, the image's platform is set in the image's
145+
configuration;
146+
147+
```console
148+
$ docker image inspect --format '{{.Os}}/{{.Architecture}}' imported:latest
149+
linux/amd64
150+
```

0 commit comments

Comments
 (0)