[Docker]镜像操作

获取镜像
[root@Proxy ~]# docker pull tomcat
Using default tag: latest
latest: Pulling from library/tomcat
7e2b2a5af8f6: Pull complete 
09b6f03ffac4: Pull complete 
dc3f0c679f0f: Pull complete 
fd4b47407fc3: Pull complete 
bb40faab53a2: Pull complete 
1015b1b4c9ac: Pull complete 
dc9b56c32795: Pull complete 
7cc86ac3141b: Pull complete 
a87d3a3ed1af: Pull complete 
4ef7fc58bece: Pull complete 
Digest: sha256:1458fb9bb9d3d46d3129f95849233e31d82391723830ebd61441c24635460b84
Status: Downloaded newer image for tomcat:latest
docker.io/library/tomcat:latest
查看Docker镜像
[root@Proxy ~]# docker images
REPOSITORY                      TAG                 IMAGE ID            CREATED             SIZE
tomcat                          latest              31a47677561a        2 days ago          529MB
zabbix/zabbix-server-mysql      latest              fbc86ce35f52        2 weeks ago         64.7MB
zabbix/zabbix-web-nginx-mysql   latest              0efb08709a91        2 weeks ago         167MB
mysql                           5.7                 413be204e9c3        2 weeks ago         456MB
zabbix/zabbix-agent             centos-4.4-latest   322c6c685990        3 weeks ago         229MB
Docker体积
[root@Proxy ~]# docker system df
TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              5                   0                   1.44GB              1.44GB (100%)
Containers          0                   0                   0B                  0B
Local Volumes       19                  0                   312.8MB             312.8MB (100%)
Build Cache         0                   0                   0B                  0B
Docker 删除镜像
[root@Proxy ~]# docker rmi nginx
Untagged: nginx:latest
Untagged: nginx@sha256:d81f010955749350ef31a119fb94b180fde8b2f157da351ff5667ae037968b28
Deleted: sha256:e791337790a6181d5ce870b3bb16de1a4d5aa3a916e8fba6907f57eb409934cf
Deleted: sha256:615a169a3412634ebf75d5f0f5162290fb6042ba36285bd0ddc9ee123165b95e
Deleted: sha256:bd32d67adcec3dba661c5afebc8a2a5413e68a3283b5ad7df134ed86f00b380a
Deleted: sha256:b60e5c3bcef2f42ec42648b3acf7baf6de1fa780ca16d9180f3b4a3f266fe7bc
Docker 镜像保存到本地
[root@localhost ~]# docker images
REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
timescale/timescaledb   latest-pg11         5f6d3db88e6c        6 weeks ago         178MB
[root@localhost ~]# docker save timescale/timescaledb:latest-pg11 > timescale.tar
Docker 镜像读取
[root@localhost ~]# docker load -i timescale.tar
50644c29ef5a: Loading layer [==================================================>]  5.845MB/5.845MB
62c057152789: Loading layer [==================================================>]  12.29kB/12.29kB
731b196c42df: Loading layer [==================================================>]  1.536kB/1.536kB
cc6c681f598c: Loading layer [==================================================>]  152.8MB/152.8MB
6104ac6cfbd5: Loading layer [==================================================>]  27.65kB/27.65kB
5b21c3897a42: Loading layer [==================================================>]  2.048kB/2.048kB
20f3500e6e83: Loading layer [==================================================>]  3.072kB/3.072kB
7fcfe037326e: Loading layer [==================================================>]  14.34kB/14.34kB
22173321eaad: Loading layer [==================================================>]  1.536kB/1.536kB
d13a83ec803b: Loading layer [==================================================>]  10.75kB/10.75kB
23bc8d8b7767: Loading layer [==================================================>]  11.06MB/11.06MB
9129a90dd507: Loading layer [==================================================>]  4.578MB/4.578MB
656abdad201d: Loading layer [==================================================>]  560.6kB/560.6kB
106a83276262: Loading layer [==================================================>]   6.65MB/6.65MB
Loaded image: timescale/timescaledb:latest-pg11

END

posted @ 2020-04-20 05:55  LeoShi2020  阅读(217)  评论(0)    收藏  举报