怎麼解壓縮檔案到docker中?
#解壓縮檔案到docker中的方法:
1.查看映像,然後透過docker save指令將映像儲存為檔案(歸檔檔案)
[root@localhost ~]# docker save -o es.tar docker.io/elasticsearch:2.3.4 #-o 后面的es.tar是归档文件的名字 [root@localhost ~]# ls -l es.tar -rw------- 1 root root 352998912 Dec 7 04:30 es.tar
備註:上面的動作是將一個映像儲存為tar檔案
2.將多個映像儲存為tar檔案
[root@localhost ~]# docker save -o es.tar docker.io/elasticsearch:2.3.4 es_ik:5.4.3 [root@localhost ~]# ls -l es.tar -rw------- 1 root root 694486528 Dec 7 04:34 es.tar
3.匯入已儲存的映像(為了測試,匯入之前先刪除,如果在其他機器匯入則沒有刪除的動作)
[root@localhost ~]# docker rmi -f docker.io/elasticsearch:2.3.4 Untagged: docker.io/elasticsearch:2.3.4 Untagged: docker.io/elasticsearch@sha256:7a09f0b9204b0e331eb7031bf30e12c8138c53c61938d59bb07b9a1c6de93483 [root@localhost ~]# docker rmi -f es_ik:5.4.3 Untagged: es_ik:5.4.3 Deleted: sha256:d206bf74d16854e62c16f0b790811d8484c4e5c326f6a6d8cbd77cf0a8192464 [root@localhost ~]# docker images | grep es_ik harbor.dcos.xixian.unicom.local/zongbu_newcs_ps/es_ik194 2.3.4 bbdf066111a2 7 days ago 374 MB es_ik1.9.4 2.3.4 82536873c337 8 days ago 359 MB es_ik_1 5.4.3 71c5f7d27500 3 months ago 339 MB [root@localhost ~]# docker images | grep docker.io/elasticsearch docker.io/elasticsearch
執行匯入:
[root@localhost ~]# docker load --input es.tar Loaded image: es_ik:5.4.3 Loaded image: docker.io/elasticsearch:2.3.4 [root@localhost ~]# docker images | grep docker.io/elasticsearch docker.io/elasticsearch latest 097d037f8ff8 3 months ago 486 MB docker.io/elasticsearch 2.3.4 ca69fe441e9d 2 years ago 345 MB [root@localhost ~]# docker images | grep es_ik harbor.dcos.xixian.unicom.local/zongbu_newcs_ps/es_ik194 2.3.4 bbdf066111a2 7 days ago 374 MB es_ik1.9.4 2.3.4 82536873c337 8 days ago 359 MB es_ik_1 5.4.3 71c5f7d27500 3 months ago 339 MB es_ik
推薦教學:《docker影片教學》
以上是怎麼解壓縮檔案到docker?的詳細內容。更多資訊請關注PHP中文網其他相關文章!