您好,登錄后才能下訂單哦!
這篇文章主要介紹Docker images如何導(dǎo)出和導(dǎo)入,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!
[root@wxtest1607 ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE tomcat8 3.0 90457edaf6ff 6 hours ago 1.036 GB [root@wxtest1607 lixr]# docker save 9045 > tomcat8-apr.tar [root@wxtest1607 lixr]# ls -lh 總用量 1.2G -rw-r--r-- 1 root root 1005M 8月 24 17:42 tomcat8-apr.tar
當(dāng)前缺一臺CentOS7服務(wù)器,實(shí)踐方式變成,先刪除image,然后再導(dǎo)入,折騰呀!
[root@wxtest1607 lixr]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE tomcat8 3.0 90457edaf6ff 7 hours ago 1.036 GB [root@wxtest1607 lixr]# docker rmi 9045 Untagged: tomcat8:3.0 Deleted: sha256:90457edaf6ff4ce328dd8a3131789c66e6bd89e1ce40096b89dd49d6e9d62bc8 Deleted: sha256:00df1d61992f2d87e7149dffa7afa5907df3296f5775c53e3ee731972e253600 [root@wxtest1607 lixr]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE [root@wxtest1607 lixr]# docker load < tomcat8-apr.tar 60685807648a: Loading layer [==================================================>] 442.7 MB/442.7 MB [root@wxtest1607 lixr]# yer [> ] 527.7 kB/442.7 MB [root@wxtest1607 lixr]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE <none> <none> 90457edaf6ff 7 hours ago 1.036 GB [root@wxtest1607 lixr]# docker tag 9045 tomcat8-apr:3.0 [root@wxtest1607 lixr]# [root@wxtest1607 lixr]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE tomcat8-apr 3.0 90457edaf6ff 7 hours ago 1.036 GB
[root@wxtest1607 lixr]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES b91d9ad83efa 9045 "/bin/bash" 18 seconds ago Up 15 seconds trusting_colden f680b58163ab aa79 "/bin/bash" 8 hours ago Up 8 hours stupefied_mayer 4db6aa9b8278 4052 "mysqld_safe" 21 hours ago Up 21 hours 8080/tcp, 0.0.0.0:53307->3306/tcp nostalgic_leavitt 7bcfe52af7a0 599d "mysqld_safe" 21 hours ago Up 21 hours 8080/tcp, 0.0.0.0:53306->3306/tcp sleepy_hodgkin [root@wxtest1607 lixr]# [root@wxtest1607 lixr]# [root@wxtest1607 lixr]# docker export b91d9ad83efa > tomcat80824.tar [root@wxtest1607 lixr]# ls -lh 總用量 2.1G -rw-r--r-- 1 root root 943M 8月 24 18:37 tomcat80824.tar -rw-r--r-- 1 root root 1005M 8月 24 17:42 tomcat8-apr.tar
b91d9ad83efa 是 鏡像90457edaf6ff 啟動(dòng)后的容器。
鏡像導(dǎo)出的文件比容器導(dǎo)出文件大哦。
[root@wxtest1607 lixr]# docker import tomcat80824.tar sha256:880fc96a6bb6abdfa949a56d40ef76f32f086fa11024ddcfb4e4e8b22041d5f2 [root@wxtest1607 lixr]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE <none> <none> 880fc96a6bb6 6 seconds ago 971.9 MB [root@wxtest1607 lixr]# docker tag 880f tomcat80824:1.0 [root@wxtest1607 lixr]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE tomcat80824 1.0 880fc96a6bb6 About a minute ago 971.9 MB tomcat8-apr 3.0 90457edaf6ff 8 hours ago 1.036 GB
鏡像導(dǎo)入和容器導(dǎo)入的區(qū)別:
1)容器導(dǎo)入 是將當(dāng)前容器 變成一個(gè)新的鏡像
2)鏡像導(dǎo)入 是復(fù)制的過程
save 和 export區(qū)別:
1)save 保存鏡像所有的信息-包含歷史
2)export 只導(dǎo)出當(dāng)前的信息
[root@wxtest1607 lixr]# docker history 880fc96a6bb6 IMAGE CREATED CREATED BY SIZE COMMENT 880fc96a6bb6 12 minutes ago 971.9 MB Imported from - [root@wxtest1607 lixr]# docker history 90457edaf6ff IMAGE CREATED CREATED BY SIZE COMMENT 90457edaf6ff 8 hours ago /bin/bash 434.4 MB <missing> 23 hours ago /bin/bash 406.5 MB <missing> 7 weeks ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0 B <missing> 7 weeks ago /bin/sh -c #(nop) LABEL license=GPLv2 0 B <missing> 7 weeks ago /bin/sh -c #(nop) LABEL vendor=CentOS 0 B <missing> 7 weeks ago /bin/sh -c #(nop) LABEL name=CentOS Base Imag 0 B <missing> 7 weeks ago /bin/sh -c #(nop) ADD file:b3bdbca0669a03490e 194.6 MB <missing> 7 weeks ago /bin/sh -c #(nop) MAINTAINER The CentOS Proje 0 B
補(bǔ)充:docker images 詳解
docker images 用于查看本地已下載的鏡像
[root@localhost ~]$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE centos latest 1e1148e4cc2c 2 weeks ago 202MB ubuntu latest 93fd78260bd1 5 weeks ago 86.2MB REPOSITORY # 鏡像倉庫 TAG # 鏡像標(biāo)簽 IMAGE ID # 鏡像ID CREATED # 鏡像創(chuàng)建時(shí)間 SIZE # 鏡像大小
以上是“Docker images如何導(dǎo)出和導(dǎo)入”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注億速云行業(yè)資訊頻道!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。