官网文档地址:https://docs.docker.com/engine/reference/commandline/save/

创建一个与镜像相同的docker备份。

1、重定向> 进行保存

$ docker save busybox > busybox.tar

$ ls -sh busybox.tar

2.7M busybox.tar

2、使用--output参数,进行保存

$ docker save --output busybox.tar busybox

$ ls -sh busybox.tar

2.7M busybox.tar

3、使用-o参数,进行保存

$ docker save -o fedora-all.tar fedora

$ docker save -o fedora-latest.tar fedora:latest

使用gzip将docker镜像保存到tar.gz文件中

You can use gzip to save the image file and make the backup smaller.

docker save myimage:latest | gzip > myimage_latest.tar.gz
选择特定标签的镜像进行保存

You can even cherry-pick particular tags of an image repository.

$ docker save -o ubuntu.tar ubuntu:lucid ubuntu:saucy

保存
docker save -o aaa_v1.tar aaa:v1
导入
docker load -i aaa_v1.tar

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐