怎么解压文件到docker中?
时间:2022-02-28 15:10
怎么解压文件到docker中? 解压文件到docker中的方法: 1.查看镜像,然后通过docker save命令将镜像保存为文件(归档文件) 备注:上面的操作是将一个镜像保存为tar文件 2.将多个镜像保存为tar文件 3.导入保存的镜像(为了测试,导入之前先删除,如果在其他机器导入则没有删除的动作) 执行导入: 推荐教程:《docker视频教程》 以上就是怎么解压文件到docker中?的详细内容,更多请关注gxlcms其它相关文章![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
[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
[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