Docker search命令用来从Docker Hub查找镜像。命令帮助信息如下:
[root@localhost ~]# docker search --help Usage: docker search [OPTIONS] TERM Search the Docker Hub for images Options: -f, --filter filter Filter output based on conditions provided --format string Pretty-print search using a Go template --limit int Max number of search results (default 25) --no-trunc Don't truncate output
其中:
-f, --filter filter 使用提供的条件过滤输出。
--format string 使用Go模板输出格式友好的信息。
--limit int 搜索结果的最大数(默认为25)
--no-trunc 不截断输出,完整输出镜像信息。
实例1:从Docket hub搜索tomcat镜像。
[root@localhost ~]# docker search tomcat NAME DESCRIPTION STARS OFFICIAL AUTOMATED tomcat Apache Tomcat is an open source implementati… 2463 [OK] tomee Apache TomEE is an all-Apache Java EE certif… 66 [OK] dordoka/tomcat Ubuntu 14.04, Oracle JDK 8 and Tomcat 8 base… 53 [OK] bitnami/tomcat Bitnami Tomcat Docker Image 29 [OK] kubeguide/tomcat-app Tomcat image for Chapter 1 26 consol/tomcat-7.0 Tomcat 7.0.57, 8080, "admin/admin" 16 [OK] cloudesire/tomcat Tomcat server, 6/7/8 15 [OK] tutum/tomcat Base docker image to run a Tomcat applicatio… 11 aallam/tomcat-mysql Debian, Oracle JDK, Tomcat & MySQL 11 [OK] arm32v7/tomcat Apache Tomcat is an open source implementati… 6 rightctrl/tomcat CentOS , Oracle Java, tomcat application ssl… 5 [OK] maluuba/tomcat7-java8 Tomcat7 with java8. 3 arm64v8/tomcat Apache Tomcat is an open source implementati… 2 amd64/tomcat Apache Tomcat is an open source implementati… 2 camptocamp/tomcat-logback Docker image for tomcat with logback integra… 1 [OK] ppc64le/tomcat Apache Tomcat is an open source implementati… 1 99taxis/tomcat7 Tomcat7 1 [OK] i386/tomcat Apache Tomcat is an open source implementati… 1 s390x/tomcat Apache Tomcat is an open source implementati… 0 secoresearch/tomcat-varnish Tomcat and Varnish 5.0 0 [OK] picoded/tomcat7 tomcat7 with jre8 and MANAGER_USER / MANAGER… 0 [OK] oobsri/tomcat8 Testing CI Jobs with different names. 0 cfje/tomcat-resource Tomcat Concourse Resource 0 jelastic/tomcat An image of the Tomcat Java application serv… 0 appsvc/tomcat 0
实例2:从Docker hub搜索tomcat镜像,且最多显示5条数据。
[root@localhost ~]# docker search tomcat --limit 5 NAME DESCRIPTION STARS OFFICIAL AUTOMATED tomcat Apache Tomcat is an open source implementati… 2463 [OK] bitnami/tomcat Bitnami Tomcat Docker Image 29 [OK] rightctrl/tomcat CentOS , Oracle Java, tomcat application ssl… 5 [OK] jelastic/tomcat An image of the Tomcat Java application serv… 0 cfje/tomcat-resource Tomcat Concourse Resource 0
实例3:使用-s限制搜索STARS的个数,“-s 30”搜索星数大于30的镜像。如下:
[root@localhost ~]# docker search -s 30 tomcat Flag --stars has been deprecated, use --filter=stars=3 instead NAME DESCRIPTION STARS OFFICIAL AUTOMATED tomcat Apache Tomcat is an open source implementati… 2463 [OK] tomee Apache TomEE is an all-Apache Java EE certif… 66 [OK] dordoka/tomcat Ubuntu 14.04, Oracle JDK 8 and Tomcat 8 base… 53 [OK]
注意:--start或-s已经被弃用,使用--filter替换
[root@localhost ~]# docker search --filter=stars=30 tomcat NAME DESCRIPTION STARS OFFICIAL AUTOMATED tomcat Apache Tomcat is an open source implementati… 2463 [OK] tomee Apache TomEE is an all-Apache Java EE certif… 66 [OK] dordoka/tomcat Ubuntu 14.04, Oracle JDK 8 and Tomcat 8 base… 53 [OK]
使用“--no-trunc”指定不截取镜像信息,如下图:
[root@localhost ~]# docker search --filter=stars=30 --no-trunc tomcat NAME DESCRIPTION STARS OFFICIAL AUTOMATED tomcat Apache Tomcat is an open source implementation of the Java Servlet and JavaServer Pages technologies 2463 [OK] tomee Apache TomEE is an all-Apache Java EE certified stack where Apache Tomcat is top dog. 66 [OK] dordoka/tomcat Ubuntu 14.04, Oracle JDK 8 and Tomcat 8 based docker container. 53 [OK]