Docker镜像迁移
2017-12-29 10:02
155 查看
Docker镜像迁移
实验环境
操作系统:CentOS Linux release 7.3.1611 (Core) docker版本: 17.11.0-ce
镜像备份
查看现有docker镜像:[root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE eg_postgresql latest 431a93e7033e 2 weeks ago 318MB centos latest 3fa822599e10 4 weeks ago 204MB hello-world latest f2a91732366c 5 weeks ago 1.85kB
将镜像hello-world保存为归档文件并压缩生成压缩包hello-world-lastest.tar.gz
[root@localhost ~]# docker save hello-world |gzip >hello-world-lastest.tar.gz [root@localhost ~]# ls anaconda-ks.cfg Documents hello-world-lastest.tar.gz Music Pictures Templates Desktop Downloads initial-setup-ks.cfg original-ks.cfg Public Videos
加载镜像
这里我使用的是一台机器,所以先删除hello-world镜像,再使用加载命令恢复:删除镜像:
[root@localhost ~]# docker rmi f2a91732366c --force Untagged: hello-world:latest Untagged: hello-world@sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c Deleted: sha256:f2a91732366c0332ccd7afd2a5c4ff2b9af81f549370f7a19acd460f87686bc7 [root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE eg_postgresql latest 431a93e7033e 2 weeks ago 318MB centos latest 3fa822599e10 4 weeks ago 204MB
加载镜像的归档文件包:
[root@localhost ~]# docker load -i hello-world-lastest.tar.gz Loaded image: hello-world:latest
检查机器中的镜像:
[root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE eg_postgresql latest 431a93e7033e 2 weeks ago 318MB centos latest 3fa822599e10 4 weeks ago 204MB hello-world latest f2a91732366c 5 weeks ago 1.85kB
发现hello-world镜像已经成功恢复
相关文章推荐
- Docker镜像迁移
- Docker镜像迁移
- docker 镜像的迁移
- 不通过docker registry共享下载的image(docker镜像本地迁移)
- Docker镜像迁移
- Docker升级1.10+迁移镜像方法
- [DockerRegistry]DockerV1v2镜像迁移
- Docker镜像迁移
- Docker镜像迁移
- Docker镜像迁移
- Docker教程:Docker镜像导出及迁移
- Docker镜像迁移
- Docker教程:Docker镜像导出及迁移
- Docker镜像迁移
- Docker教程:Docker镜像导出及迁移
- Docker - 手动迁移镜像
- Docker镜像迁移
- Docker镜像迁移
- Docker镜像迁移
- Docker - 手动迁移镜像