docker

关注公众号 jb51net

关闭
首页 > 网站技巧 > 服务器 > 云和虚拟化 > docker > docker search 搜索镜像

docker search 搜索镜像的实现示例

作者:明迪

本文主要介绍了docker search搜索镜像的实现示例,文中通过示例代码介绍的非常详细,需要的朋友们下面随着小编来一起学习学习吧

docker search

说明:从Docker Hub查找(搜索)镜像
语法:docker search [OPTIONS] TERM

OPTIONS说明:
--automated :只列出 automated build类型的镜像;
--no-trunc :显示完整的镜像DESCRIPTION(描述),不省略;
-f <过滤条件>:列出收藏数(点赞)不小于指定值的镜像。
--limit 5:列出前5个镜像

【示例一】搜索镜像名称中包含java相关的所有镜像

docker search java

[root@CentOS8 ~]# docker search java
NAME                                     DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
node                                     Node.js is a JavaScript-based platform for s…   10810     [OK]       
tomcat                                   Apache Tomcat is an open source implementati…   3184      [OK]       
openjdk                                  OpenJDK is an open-source implementation of …   3038      [OK]       
java                                     DEPRECATED; use "openjdk" (or other JDK impl…   1976      [OK]       
ghost                                    Ghost is a free and open source blogging pla…   1447      [OK]       
lwieske/java-8                           Oracle Java 8 Container - Full + Slim - Base…   50                   [OK]
nimmis/java-centos                       This is docker images of CentOS 7 with diffe…   42                   [OK]
fabric8/java-jboss-openjdk8-jdk          Fabric8 Java Base Image (JBoss, OpenJDK 8)      29                   [OK]
fabric8/java-alpine-openjdk8-jdk         Fabric8 Java Base Image (Alpine, OpenJDK 8, …   23                   [OK]
timbru31/java-node                       OpenJDK JRE or JDK (8 or 11) with Node.js 12…   19                   [OK]
cloudbees/java-build-tools               Docker image with commonly used tools to bui…   16                   [OK]
fabric8/java-centos-openjdk8-jdk         Fabric8 Java Base Image (CentOS, OpenJDK 8, …   14                   [OK]
frekele/java                             docker run --rm --name java frekele/java        12                   [OK]
blacklabelops/java                       Java Base Images.                               8                    [OK]
fabric8/java-centos-openjdk8-jre         Fabric8 Java Base Image (CentOS, OpenJDK 8, …   4                    [OK]
rightctrl/java                           Oracle Java                                     3                    [OK]
cfje/java-test-applications              Java Test Applications CI Image                 2                    
jelastic/javaengine                      An image of the Java Engine server maintaine…   1                    
cfje/java-buildpack                      Java Buildpack CI Image                         1                    
cfje/java-resource                       Java Concourse Resource                         1                    
buildo/java8-wkhtmltopdf                 Java 8 + wkhtmltopdf                            1                    [OK]
cfje/java-buildpack-dependency-builder   Java Buildpack Dependencies Builder Image       0                    
thingswise/java-docker                   Java + dcd                                      0                    [OK]
cfje/java-buildpack-memory-calculator    Java Buildpack Memory Calculator CI Image       0                    
adorsys/java                             Java Runtime Image                              0                    [OK]

列表说明:
NAME:镜像名(镜像仓库源的名称)
DESCRIPTION:对该镜像的描述
STARS:类似 Github 里面的 star,表示点赞、喜欢的意思
OFFICIAL:是否 docker 官方发布
AUTOMATED:是否自动构建。

【示例二】搜索java相关的,并且stars收藏数(点赞)不小于10以上的镜像

docker search -f stars=10 java

[root@CentOS8 ~]# docker search -f stars=10 java
NAME                               DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
node                               Node.js is a JavaScript-based platform for s…   10810     [OK]       
tomcat                             Apache Tomcat is an open source implementati…   3184      [OK]       
openjdk                            OpenJDK is an open-source implementation of …   3038      [OK]       
java                               DEPRECATED; use "openjdk" (or other JDK impl…   1976      [OK]       
ghost                              Ghost is a free and open source blogging pla…   1447      [OK]       
lwieske/java-8                     Oracle Java 8 Container - Full + Slim - Base…   50                   [OK]
nimmis/java-centos                 This is docker images of CentOS 7 with diffe…   42                   [OK]
fabric8/java-jboss-openjdk8-jdk    Fabric8 Java Base Image (JBoss, OpenJDK 8)      29                   [OK]
fabric8/java-alpine-openjdk8-jdk   Fabric8 Java Base Image (Alpine, OpenJDK 8, …   23                   [OK]
timbru31/java-node                 OpenJDK JRE or JDK (8 or 11) with Node.js 12…   19                   [OK]
cloudbees/java-build-tools         Docker image with commonly used tools to bui…   16                   [OK]
fabric8/java-centos-openjdk8-jdk   Fabric8 Java Base Image (CentOS, OpenJDK 8, …   14                   [OK]
frekele/java                       docker run --rm --name java frekele/java        12                   [OK]

【示例三】搜索java相关的前5个镜像

docker search java --limit 5

[root@CentOS8 ~]# docker search java --limit 5
NAME           DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
node           Node.js is a JavaScript-based platform for s…   10810     [OK]       
tomcat         Apache Tomcat is an open source implementati…   3184      [OK]       
openjdk        OpenJDK is an open-source implementation of …   3038      [OK]       
java           DEPRECATED; use "openjdk" (or other JDK impl…   1976      [OK]       
frekele/java   docker run --rm --name java frekele/java        12                   [OK]

【示例四】只搜索自动构建的镜像

AUTOMATED为[OK]的docker search -f is-automated=true java

[root@CentOS8 ~]# docker search -f is-automated=true java
NAME                                DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
lwieske/java-8                      Oracle Java 8 Container - Full + Slim - Base…   50                   [OK]
nimmis/java-centos                  This is docker images of CentOS 7 with diffe…   42                   [OK]
fabric8/java-jboss-openjdk8-jdk     Fabric8 Java Base Image (JBoss, OpenJDK 8)      29                   [OK]
fabric8/java-alpine-openjdk8-jdk    Fabric8 Java Base Image (Alpine, OpenJDK 8, …   23                   [OK]
timbru31/java-node                  OpenJDK JRE or JDK (8 or 11) with Node.js 12…   19                   [OK]
cloudbees/java-build-tools          Docker image with commonly used tools to bui…   16                   [OK]
fabric8/java-centos-openjdk8-jdk    Fabric8 Java Base Image (CentOS, OpenJDK 8, …   14                   [OK]
fabric8/java-alpine-openjdk8-jre    Fabric8 Java Base Image (Alpine, OpenJDK 8, …   13                   [OK]
frekele/java                        docker run --rm --name java frekele/java        12                   [OK]
blacklabelops/java                  Java Base Images.                               8                    [OK]
cloudbees/java-with-docker-client   Java image with Docker client installed, use…   4                    [OK]
rightctrl/java                      Oracle Java                                     3                    [OK]
buildo/java8-wkhtmltopdf            Java 8 + wkhtmltopdf                            1                    [OK]
adorsys/java                        Java Runtime Image                              0                    [OK]
thingswise/java-docker              Java + dcd                                      0                    [OK]

【示例五】只搜索官方镜像

docker search -f is-official=true java

[root@CentOS8 ~]# docker search -f is-official=true java
NAME      DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
node      Node.js is a JavaScript-based platform for s…   10810     [OK]       
tomcat    Apache Tomcat is an open source implementati…   3184      [OK]       
openjdk   OpenJDK is an open-source implementation of …   3038      [OK]       
java      DEPRECATED; use "openjdk" (or other JDK impl…   1976      [OK]       
ghost     Ghost is a free and open source blogging pla…   1447      [OK] 

格式化搜索输出:--fomat

镜像描述:.Description
star数量:.StarCount
官方镜像:.IsOfficial
自动构建:.IsAutomated
注意:每个参数前面都有一个点,所以英文加了黑色背景

【示例一】只显示镜像名和stars收藏数(点赞)

docker search --format "{{.Name}}: {{.StarCount}}" java

【示例二】只显示镜像名、自动构建和官方的镜像

[root@CentOS8 ~]# docker search --format "table {{.Name}}\t{{.IsAutomated}}\t{{.IsOfficial}}" java
NAME                                     AUTOMATED   OFFICIAL
node                                                 [OK]
tomcat                                               [OK]
openjdk                                              [OK]
java                                                 [OK]
ghost                                                [OK]
lwieske/java-8                           [OK]        
nimmis/java-centos                       [OK]        
fabric8/java-jboss-openjdk8-jdk          [OK]        
fabric8/java-alpine-openjdk8-jdk         [OK]        
timbru31/java-node                       [OK]        
cloudbees/java-build-tools               [OK]        
fabric8/java-centos-openjdk8-jdk         [OK]        
fabric8/java-alpine-openjdk8-jre         [OK]        
frekele/java                             [OK]        
blacklabelops/java                       [OK]        
cloudbees/java-with-docker-client        [OK]        
rightctrl/java                           [OK]        
cfje/java-test-applications                          
jelastic/javaengine                                  
cfje/java-buildpack                                  
cfje/java-resource                                   
buildo/java8-wkhtmltopdf                 [OK]        
cfje/java-buildpack-dependency-builder               
adorsys/java                             [OK]        
thingswise/java-docker                   [OK]        

到此这篇关于docker search 搜索镜像的实现示例的文章就介绍到这了,更多相关docker search 搜索镜像内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家! 

您可能感兴趣的文章:
阅读全文