Docker - 手动迁移镜像
生活随笔
收集整理的這篇文章主要介紹了
Docker - 手动迁移镜像
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在沒有Docker Registry時,可以通過docker save和docker load命令完成鏡像遷移的過程,先將鏡像保存為壓縮包,然后在其他位置再加載壓縮包。
將鏡像保存為壓縮包文件
[root@CentOS-7 ~]# docker images nginx REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/nginx latest 5766334bdaa0 2 weeks ago 182.5 MB [root@CentOS-7 ~]# [root@CentOS-7 ~]# docker save nginx | gzip > nginx-latest.tar.gz [root@CentOS-7 ~]# [root@CentOS-7 ~]# ls -lh nginx-latest.tar.gz -rw-r--r-- 1 root root 69M Apr 24 17:28 nginx-latest.tar.gz [root@CentOS-7 ~]#加載鏡像
# docker images nginx REPOSITORY TAG IMAGE ID CREATED SIZE # # docker load -i nginx-latest.tar.gz 5d6cbe0dbcf9: Loading layer [==================================================>] 129.2 MB/129.2 MB aca7b1f22e02: Loading layer [==================================================>] 9.216 kB/9.216 kB 31fc28b38091: Loading layer [==================================================>] 61.24 MB/61.24 MB 97b903fe0f6f: Loading layer [==================================================>] 3.584 kB/3.584 kB Loaded image: docker.io/nginx:latest> ] 512 B/3.584 kB # # docker images nginx REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/nginx latest 5766334bdaa0 2 weeks ago 182.5 MB #快捷命令
將鏡像從一個主機遷移到另一個主機:
docker save | bzip2 | ssh @ "cat | docker load"
轉載于:https://www.cnblogs.com/anliven/p/6759585.html
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的Docker - 手动迁移镜像的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux Ubuntu常用命令
- 下一篇: 从面向过程到面向对象