docker镜像常用命令

docker pull XXX 拉取指定镜像

redis后面没有跟TAG,默认下载latest,即最新版本,所有没有指定TAG的,默认都是latest

[root@centos8 etc]# docker pull redis
Using default tag: latest
latest: Pulling from library/redis
7d63c13d9b9b: Pull complete 
a2c3b174c5ad: Pull complete 
283a10257b0f: Pull complete 
7a08c63a873a: Pull complete 
0531663a7f55: Pull complete 
9bf50efb265c: Pull complete 
Digest: sha256:a89cb097693dd354de598d279c304a1c73ee550fbfff6d9ee515568e0c749cfe
Status: Downloaded newer image for redis:latest
docker.io/library/redis:latest

redis:6,下载TAG为6的版本

[root@centos8 etc]# docker pull redis:6 
6: Pulling from library/redis
Digest: sha256:a89cb097693dd354de598d279c304a1c73ee550fbfff6d9ee515568e0c749cfe
Status: Downloaded newer image for redis:6
docker.io/library/redis:6

docker images 查看所有镜像

[root@centos8 etc]# docker images
REPOSITORY    TAG       IMAGE ID       CREATED       SIZE
redis         6         7faaec683238   2 days ago    113MB
redis         latest    7faaec683238   2 days ago    113MB
hello-world   latest    feb5d9fea6a5   2 weeks ago   13.3kB

docker rmi XXX 删除指定镜像

所有没有指定TAG的,默认是latest

[root@centos8 etc]# docker rmi redis
Untagged: redis:latest
Untagged: redis@sha256:a89cb097693dd354de598d279c304a1c73ee550fbfff6d9ee515568e0c749cfe
Deleted: sha256:7faaec68323851b2265bddb239bd9476c7d4e4335e9fd88cbfcc1df374dded2f
Deleted: sha256:e6deb90762475cda72e21895911f830ed99fd1cc6d920d92873270be91235274
Deleted: sha256:2649acad13241d9c8d81e49357bc66cce459b352ded7f423d70ede7bd3bb7b89
Deleted: sha256:64007bba5fc220df4d3da33cecdc2d55dd6a73528c138b0fa1acd79fd6a9c217

指定TAG的

[root@centos8 etc]# docker rmi redis:6
Untagged: redis:6
Untagged: redis@sha256:a89cb097693dd354de598d279c304a1c73ee550fbfff6d9ee515568e0c749cfe
Deleted: sha256:7faaec68323851b2265bddb239bd9476c7d4e4335e9fd88cbfcc1df374dded2f
Deleted: sha256:e6deb90762475cda72e21895911f830ed99fd1cc6d920d92873270be91235274
Deleted: sha256:2649acad13241d9c8d81e49357bc66cce459b352ded7f423d70ede7bd3bb7b89
Deleted: sha256:64007bba5fc220df4d3da33cecdc2d55dd6a73528c138b0fa1acd79fd6a9c217
Deleted: sha256:b2cc2f1bf8b1cca8ba7c19e1697f7b73755903ad8f880b83673fd6a697aca935
Deleted: sha256:fbd1283ab782925be4d990bd4bebe9ad5e5cf9a525abfb6fa87465e072da9d31
Deleted: sha256:e8b689711f21f9301c40bf2131ce1a1905c3aa09def1de5ec43cf0adf652576e

通过指定id去删

[root@centos8 etc]# docker images
REPOSITORY    TAG       IMAGE ID       CREATED       SIZE
redis         5         02fee89f17ad   2 days ago    110MB
nginx         latest    87a94228f133   2 days ago    133MB
hello-world   latest    feb5d9fea6a5   2 weeks ago   13.3kB
[root@centos8 etc]# docker rmi 02fee89f17ad
Untagged: redis:5
Untagged: redis@sha256:8217ee751b6a72bc4b3ef757c18aa9619e939d5073d5a26ce2074905385000b0
Deleted: sha256:02fee89f17adc8213b560b929d5ac585137612651f8eeb26423aadfe39dc3847

docker search XXX 搜索指定镜像

OFFICIAL代表镜像官方提供的镜像

[root@centos8 etc]# docker search redis
NAME                             DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
redis                            Redis is an open source key-value store that…   10034     [OK]       
grokzen/redis-cluster            Redis cluster 3.0, 3.2, 4.0, 5.0, 6.0, 6.2      79                   
rediscommander/redis-commander   Alpine image for redis-commander - Redis man…   66                   [OK]
redislabs/redisearch             Redis With the RedisSearch module pre-loaded…   39                   
redislabs/redisinsight           RedisInsight - The GUI for Redis                35                   
kubeguide/redis-master           redis-master with "Hello World!"                33                   
redislabs/redis                  Clustered in-memory database engine compatib…   31                   
oliver006/redis_exporter          Prometheus Exporter for Redis Metrics. Supp…   30                   
redislabs/rejson                 RedisJSON - Enhanced JSON data type processi…   27                   
arm32v7/redis                    Redis is an open source key-value store that…   25                   
redislabs/redisgraph             A graph database module for Redis               16                   [OK]
redislabs/redismod               An automated build of redismod - latest Redi…   15                   [OK]
arm64v8/redis                    Redis is an open source key-value store that…   15                   
redislabs/rebloom                A probablistic datatypes module for Redis       14                   [OK]
webhippie/redis                  Docker image for redis                          11                   [OK]
insready/redis-stat              Docker image for the real-time Redis monitor…   10                   [OK]
redislabs/redistimeseries        A time series database module for Redis         10                   
s7anley/redis-sentinel-docker    Redis Sentinel                                  10                   [OK]
goodsmileduck/redis-cli          redis-cli on alpine                             9                    [OK]
centos/redis-32-centos7          Redis in-memory data structure store, used a…   5                    
clearlinux/redis                 Redis key-value data structure server with t…   3                    
tiredofit/redis                  Redis Server w/ Zabbix monitoring and S6 Ove…   1                    [OK]
wodby/redis                      Redis container image with orchestration        1                    [OK]
runnable/redis-stunnel           stunnel to redis provided by linking contain…   1                    [OK]
xetamus/redis-resource           forked redis-resource                           0                    [OK]

posted @ 2021-10-15 00:02  cheems~  阅读(78)  评论(0编辑  收藏  举报