Docker 镜像的导出与导入
需求
导出本地项目 docker 配置为独立镜像
导入本地镜像到 docker 中
导出
docker save [OPTIONS] IMAGE [IMAGE...]
复制代码
OPTIONS
--output , -o Write to a file, instead of STDOUT
例子
$ docker save busybox > busybox.tar$ ls -sh busybox.tar
2.7M busybox.tar$ docker save --output busybox.tar busybox$ ls -sh busybox.tar
2.7M busybox.tar$ docker save -o fedora-all.tar fedora$ docker save -o fedora-latest.tar fedora:latest
复制代码
导入
OPTIONS
--input, -i Read from tar archive file, instead of STDIN
--quiet , -q Suppress the load output
例子
$ docker load < busybox.tar.gz
Loaded image: busybox:latest$ docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEbusybox latest 769b9341d937 7 weeks ago 2.489 MB
复制代码
$ docker load --input fedora.tar
Loaded image: fedora:rawhideLoaded image: fedora:20$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZEbusybox latest 769b9341d937 7 weeks ago 2.489 MBfedora rawhide 0d20aec6529d 7 weeks ago 387 MBfedora 20 58394af37342 7 weeks ago 385.5 MBfedora heisenbug 58394af37342 7 weeks ago 385.5 MBfedora latest 58394af37342 7 weeks ago 385.5 MB
复制代码
引用
评论