Home >Operation and Maintenance >Docker >How to unzip files into docker?

How to unzip files into docker?

coldplay.xixi
coldplay.xixiOriginal
2020-06-12 10:04:415751browse

How to unzip files into docker?

How to decompress files into docker?

How to decompress files into docker:

1. View the image, and then save the image as a file (archive file) through the docker save command

[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

Note: The above operation is to save an image as a tar file

2. Save the image as a tar file

[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. Import the saved image (for testing, delete it before importing. If it is imported from another machine, there will be no deletion action)

[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

Execute the import:

[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

Recommended tutorial: "docker video tutorial"

The above is the detailed content of How to unzip files into docker?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn