镜像迁移¶
在服务器下载docker
镜像太慢了,想着能不能在本地下载完成后迁移到服务器上。在网上一查,果然有这功能,参考Docker镜像迁移
docker save¶
保存一个或多个镜像为归档文件
$ docker save --help
Usage: docker save [OPTIONS] IMAGE [IMAGE...]
Save one or more images to a tar archive (streamed to STDOUT by default)
Options:
-o, --output string Write to a file, instead of STDOUT
docker load¶
从归档文件中加载镜像
$ docker load --help
Usage: docker load [OPTIONS]
Load an image from a tar archive or STDIN
Options:
-i, --input string Read from tar archive file, instead of STDIN
-q, --quiet Suppress the load output
示例¶
# 打包
$ docker save nginx:latest -o nginx.tar.gz
# 加载
$ docker load -i nginx.tar.gz