← 返回命令列表

Linux command

docker-save 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Save image to tar file

docker save -o [image.tar] [image]

Save to stdout

docker save [image] > [image.tar]

Save with compression

docker save [image] | gzip > [image.tar.gz]

Save multiple images

docker save -o [images.tar] [image1] [image2]

Save specific tag

docker save -o [image.tar] [image]:[tag]

Save a specific platform variant

docker save --platform [linux/amd64] -o [image.tar] [image]

说明

docker save saves one or more images to a tar archive, including all parent layers, tags, and versions. Use docker load to restore. This command is useful for offline distribution, backing up images, or transferring images between systems without a registry. The resulting archive preserves the complete image with all metadata and history.

参数

-o, --output _file_
Write to file instead of stdout.
--platform _os/arch[/variant]_
Save a specific platform variant. By default, all platform variants present in the image store are saved.

FAQ

What is the docker-save command used for?

docker save saves one or more images to a tar archive, including all parent layers, tags, and versions. Use docker load to restore. This command is useful for offline distribution, backing up images, or transferring images between systems without a registry. The resulting archive preserves the complete image with all metadata and history.

How do I run a basic docker-save example?

Run `docker save -o [image.tar] [image]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -o, --output _file_ do in docker-save?

Write to file instead of stdout.