@@ -19,6 +19,18 @@ options:
1919 experimentalcli : false
2020 kubernetes : false
2121 swarm : false
22+ - option : platform
23+ value_type : string
24+ description : |
25+ Save only the given platform variant. Formatted as `os[/arch[/variant]]` (e.g., `linux/amd64`)
26+ details_url : ' #platform'
27+ deprecated : false
28+ hidden : false
29+ min_api_version : " 1.48"
30+ experimental : false
31+ experimentalcli : false
32+ kubernetes : false
33+ swarm : false
2234inherited_options :
2335 - option : help
2436 value_type : bool
@@ -66,6 +78,55 @@ examples: |-
6678 ```console
6779 $ docker save -o ubuntu.tar ubuntu:lucid ubuntu:saucy
6880 ```
81+
82+ ### Save a specific platform (--platform) {#platform}
83+
84+ The `--platform` option allows you to specify which platform variant of the
85+ image to save. By default, `docker save` saves all platform variants that
86+ are present in the daemon's image store. Use the `--platform` option
87+ to specify which platform variant of the image to save. An error is produced
88+ if the given platform is not present in the local image store.
89+
90+ The platform option takes the `os[/arch[/variant]]` format; for example,
91+ `linux/amd64` or `linux/arm64/v8`. Architecture and variant are optional,
92+ and default to the daemon's native architecture if omitted.
93+
94+ The following example pulls the RISC-V variant of the `alpine:latest` image
95+ and saves it to a tar archive.
96+
97+ ```console
98+ $ docker pull --platform=linux/riscv64 alpine:latest
99+ latest: Pulling from library/alpine
100+ 8c4a05189a5f: Download complete
101+ Digest: sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d
102+ Status: Downloaded newer image for alpine:latest
103+ docker.io/library/alpine:latest
104+
105+ $ docker image save --platform=linux/riscv64 -o alpine-riscv.tar alpine:latest
106+
107+ $ ls -lh image.tar
108+ -rw------- 1 thajeztah staff 3.9M Oct 7 11:06 alpine-riscv.tar
109+ ```
110+
111+ The following example attempts to save a platform variant of `alpine:latest`
112+ that doesn't exist in the local image store, resulting in an error.
113+
114+ ```console
115+ $ docker image ls --tree
116+ IMAGE ID DISK USAGE CONTENT SIZE IN USE
117+ alpine:latest beefdbd8a1da 10.6MB 3.37MB
118+ ├─ linux/riscv64 80cde017a105 10.6MB 3.37MB
119+ ├─ linux/amd64 33735bd63cf8 0B 0B
120+ ├─ linux/arm/v6 50f635c8b04d 0B 0B
121+ ├─ linux/arm/v7 f2f82d424957 0B 0B
122+ ├─ linux/arm64/v8 9cee2b382fe2 0B 0B
123+ ├─ linux/386 b3e87f642f5c 0B 0B
124+ ├─ linux/ppc64le c7a6800e3dc5 0B 0B
125+ └─ linux/s390x 2b5b26e09ca2 0B 0B
126+
127+ $ docker image save --platform=linux/s390x -o alpine-s390x.tar alpine:latest
128+ Error response from daemon: no suitable export target found for platform linux/s390x
129+ ```
69130deprecated : false
70131hidden : false
71132experimental : false
0 commit comments