日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Docker - 手动迁移镜像

發布時間:2025/3/21 编程问答 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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"

[root@CentOS-7 ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/hello-world latest 48b5124b2768 3 months ago 1.84 kB [root@CentOS-7 ~]# [root@CentOS-7 ~]# docker save hello-world | bzip2 | ssh root@10.140.1.120 "cat | docker load" root@10.140.1.120's password: Loaded image: docker.io/hello-world:latest [root@CentOS-7 ~]# [root@TestNode ~]# ip addr show enp0s3 2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000link/ether 08:00:27:3c:d9:72 brd ff:ff:ff:ff:ff:ffinet 10.140.1.120/24 brd 10.140.1.255 scope global dynamic enp0s3valid_lft 84898sec preferred_lft 84898secinet6 fe80::a00:27ff:fe3c:d972/64 scope link valid_lft forever preferred_lft forever [root@TestNode ~]# [root@TestNode ~]# docker images hello-world REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/hello-world latest 48b5124b2768 3 months ago 1.84 kB [root@TestNode ~]#

轉載于:https://www.cnblogs.com/anliven/p/6759585.html

《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀

總結

以上是生活随笔為你收集整理的Docker - 手动迁移镜像的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。