@@ -9,9 +9,10 @@ Save one or more images to a tar archive (streamed to STDOUT by default)
99
1010### Options
1111
12- | Name | Type | Default | Description |
13- | :-----------------| :---------| :--------| :-----------------------------------|
14- | ` -o ` , ` --output ` | ` string ` | | Write to a file, instead of STDOUT |
12+ | Name | Type | Default | Description |
13+ | :--------------------------| :---------| :--------| :-----------------------------------------------------------------------------------------------|
14+ | ` -o ` , ` --output ` | ` string ` | | Write to a file, instead of STDOUT |
15+ | [ ` --platform ` ] ( #platform ) | ` string ` | | Save only the given platform variant. Formatted as ` os[/arch[/variant]] ` (e.g., ` linux/amd64 ` ) |
1516
1617
1718<!-- -MARKER_GEN_END-->
@@ -59,3 +60,52 @@ You can even cherry-pick particular tags of an image repository.
5960``` console
6061$ docker save -o ubuntu.tar ubuntu:lucid ubuntu:saucy
6162```
63+
64+ ### <a name =" platform " ></a > Save a specific platform (--platform)
65+
66+ The ` --platform ` option allows you to specify which platform variant of the
67+ image to save. By default, ` docker save ` saves all platform variants that
68+ are present in the daemon's image store. Use the ` --platform ` option
69+ to specify which platform variant of the image to save. An error is produced
70+ if the given platform is not present in the local image store.
71+
72+ The platform option takes the ` os[/arch[/variant]] ` format; for example,
73+ ` linux/amd64 ` or ` linux/arm64/v8 ` . Architecture and variant are optional,
74+ and default to the daemon's native architecture if omitted.
75+
76+ The following example pulls the RISC-V variant of the ` alpine:latest ` image
77+ and saves it to a tar archive.
78+
79+ ``` console
80+ $ docker pull --platform=linux/riscv64 alpine:latest
81+ latest: Pulling from library/alpine
82+ 8c4a05189a5f: Download complete
83+ Digest: sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d
84+ Status: Downloaded newer image for alpine:latest
85+ docker.io/library/alpine:latest
86+
87+ $ docker image save --platform=linux/riscv64 -o alpine-riscv.tar alpine:latest
88+
89+ $ ls -lh image.tar
90+ -rw------- 1 thajeztah staff 3.9M Oct 7 11:06 alpine-riscv.tar
91+ ```
92+
93+ The following example attempts to save a platform variant of ` alpine:latest `
94+ that doesn't exist in the local image store, resulting in an error.
95+
96+ ``` console
97+ $ docker image ls --tree
98+ IMAGE ID DISK USAGE CONTENT SIZE IN USE
99+ alpine:latest beefdbd8a1da 10.6MB 3.37MB
100+ ├─ linux/riscv64 80cde017a105 10.6MB 3.37MB
101+ ├─ linux/amd64 33735bd63cf8 0B 0B
102+ ├─ linux/arm/v6 50f635c8b04d 0B 0B
103+ ├─ linux/arm/v7 f2f82d424957 0B 0B
104+ ├─ linux/arm64/v8 9cee2b382fe2 0B 0B
105+ ├─ linux/386 b3e87f642f5c 0B 0B
106+ ├─ linux/ppc64le c7a6800e3dc5 0B 0B
107+ └─ linux/s390x 2b5b26e09ca2 0B 0B
108+
109+ $ docker image save --platform=linux/s390x -o alpine-s390x.tar alpine:latest
110+ Error response from daemon: no suitable export target found for platform linux/s390x
111+ ```
0 commit comments