github.com/AliyunContainerService/cli@v0.0.0-20181009023821-814ced4b30d0/docs/reference/commandline/search.md (about)

     1  ---
     2  title: "search"
     3  description: "The search command description and usage"
     4  keywords: "search, hub, images"
     5  ---
     6  
     7  <!-- This file is maintained within the docker/cli GitHub
     8       repository at https://github.com/docker/cli/. Make all
     9       pull requests against that repo. If you see this file in
    10       another repository, consider it read-only there, as it will
    11       periodically be overwritten by the definitive file. Pull
    12       requests which include edits to this file in other repositories
    13       will be rejected.
    14  -->
    15  
    16  # search
    17  
    18  ```markdown
    19  Usage:  docker search [OPTIONS] TERM
    20  
    21  Search the Docker Hub for images
    22  
    23  Options:
    24    -f, --filter value   Filter output based on conditions provided (default [])
    25                         - is-automated=(true|false)
    26                         - is-official=(true|false)
    27                         - stars=<number> - image has at least 'number' stars
    28        --format string  Pretty-print images using a Go template
    29        --help           Print usage
    30        --limit int      Max number of search results (default 25)
    31        --no-trunc       Don't truncate output
    32  ```
    33  
    34  ## Description
    35  
    36  Search [Docker Hub](https://hub.docker.com) for images
    37  
    38  See [*Find Public Images on Docker Hub*](https://docs.docker.com/engine/tutorials/dockerrepos/#searching-for-images) for
    39  more details on finding shared images from the command line.
    40  
    41  > **Note**: Search queries return a maximum of 25 results.
    42  
    43  ## Examples
    44  
    45  ### Search images by name
    46  
    47  This example displays images with a name containing 'busybox':
    48  
    49  ```none
    50  $ docker search busybox
    51  
    52  NAME                             DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
    53  busybox                          Busybox base image.                             316       [OK]       
    54  progrium/busybox                                                                 50                   [OK]
    55  radial/busyboxplus               Full-chain, Internet enabled, busybox made...   8                    [OK]
    56  odise/busybox-python                                                             2                    [OK]
    57  azukiapp/busybox                 This image is meant to be used as the base...   2                    [OK]
    58  ofayau/busybox-jvm               Prepare busybox to install a 32 bits JVM.       1                    [OK]
    59  shingonoide/archlinux-busybox    Arch Linux, a lightweight and flexible Lin...   1                    [OK]
    60  odise/busybox-curl                                                               1                    [OK]
    61  ofayau/busybox-libc32            Busybox with 32 bits (and 64 bits) libs         1                    [OK]
    62  peelsky/zulu-openjdk-busybox                                                     1                    [OK]
    63  skomma/busybox-data              Docker image suitable for data volume cont...   1                    [OK]
    64  elektritter/busybox-teamspeak    Lightweight teamspeak3 container based on...    1                    [OK]
    65  socketplane/busybox                                                              1                    [OK]
    66  oveits/docker-nginx-busybox      This is a tiny NginX docker image based on...   0                    [OK]
    67  ggtools/busybox-ubuntu           Busybox ubuntu version with extra goodies       0                    [OK]
    68  nikfoundas/busybox-confd         Minimal busybox based distribution of confd     0                    [OK]
    69  openshift/busybox-http-app                                                       0                    [OK]
    70  jllopis/busybox                                                                  0                    [OK]
    71  swyckoff/busybox                                                                 0                    [OK]
    72  powellquiring/busybox                                                            0                    [OK]
    73  williamyeh/busybox-sh            Docker image for BusyBox's sh                   0                    [OK]
    74  simplexsys/busybox-cli-powered   Docker busybox images, with a few often us...   0                    [OK]
    75  fhisamoto/busybox-java           Busybox java                                    0                    [OK]
    76  scottabernethy/busybox                                                           0                    [OK]
    77  marclop/busybox-solr
    78  ```
    79  
    80  ### Display non-truncated description (--no-trunc)
    81  
    82  This example displays images with a name containing 'busybox',
    83  at least 3 stars and the description isn't truncated in the output:
    84  
    85  ```bash
    86  $ docker search --stars=3 --no-trunc busybox
    87  NAME                 DESCRIPTION                                                                               STARS     OFFICIAL   AUTOMATED
    88  busybox              Busybox base image.                                                                       325       [OK]       
    89  progrium/busybox                                                                                               50                   [OK]
    90  radial/busyboxplus   Full-chain, Internet enabled, busybox made from scratch. Comes in git and cURL flavors.   8                    [OK]
    91  ```
    92  
    93  ### Limit search results (--limit)
    94  
    95  The flag `--limit` is the maximum number of results returned by a search. This value could
    96  be in the range between 1 and 100. The default value of `--limit` is 25.
    97  
    98  ### Filtering
    99  
   100  The filtering flag (`-f` or `--filter`) format is a `key=value` pair. If there is more
   101  than one filter, then pass multiple flags (e.g. `--filter "foo=bar" --filter "bif=baz"`)
   102  
   103  The currently supported filters are:
   104  
   105  * stars (int - number of stars the image has)
   106  * is-automated (boolean - true or false) - is the image automated or not
   107  * is-official (boolean - true or false) - is the image official or not
   108  
   109  #### stars
   110  
   111  This example displays images with a name containing 'busybox' and at
   112  least 3 stars:
   113  
   114  ```bash
   115  $ docker search --filter stars=3 busybox
   116  
   117  NAME                 DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
   118  busybox              Busybox base image.                             325       [OK]       
   119  progrium/busybox                                                     50                   [OK]
   120  radial/busyboxplus   Full-chain, Internet enabled, busybox made...   8                    [OK]
   121  ```
   122  
   123  #### is-automated
   124  
   125  This example displays images with a name containing 'busybox'
   126  and are automated builds:
   127  
   128  ```bash
   129  $ docker search --filter is-automated busybox
   130  
   131  NAME                 DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
   132  progrium/busybox                                                     50                   [OK]
   133  radial/busyboxplus   Full-chain, Internet enabled, busybox made...   8                    [OK]
   134  ```
   135  
   136  #### is-official
   137  
   138  This example displays images with a name containing 'busybox', at least
   139  3 stars and are official builds:
   140  
   141  ```bash
   142  $ docker search --filter "is-official=true" --filter "stars=3" busybox
   143  
   144  NAME                 DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
   145  progrium/busybox                                                     50                   [OK]
   146  radial/busyboxplus   Full-chain, Internet enabled, busybox made...   8                    [OK]
   147  ```
   148  
   149  ### Format the output
   150  
   151  The formatting option (`--format`) pretty-prints search output
   152  using a Go template.
   153  
   154  Valid placeholders for the Go template are:
   155  
   156  | Placeholder    | Description                       |
   157  | -------------- | --------------------------------- |
   158  | `.Name`        | Image Name                        |
   159  | `.Description` | Image description                 |
   160  | `.StarCount`   | Number of stars for the image     |
   161  | `.IsOfficial`  | "OK" if image is official         |
   162  | `.IsAutomated` | "OK" if image build was automated |
   163  
   164  When you use the `--format` option, the `search` command will
   165  output the data exactly as the template declares. If you use the
   166  `table` directive, column headers are included as well.
   167  
   168  The following example uses a template without headers and outputs the
   169  `Name` and `StarCount` entries separated by a colon for all images:
   170  
   171  ```bash
   172  {% raw %}
   173  $ docker search --format "{{.Name}}: {{.StarCount}}" nginx
   174  
   175  nginx: 5441
   176  jwilder/nginx-proxy: 953
   177  richarvey/nginx-php-fpm: 353
   178  million12/nginx-php: 75
   179  webdevops/php-nginx: 70
   180  h3nrik/nginx-ldap: 35
   181  bitnami/nginx: 23
   182  evild/alpine-nginx: 14
   183  million12/nginx: 9
   184  maxexcloo/nginx: 7
   185  {% endraw %}
   186  ```
   187  
   188  This example outputs a table format:
   189  
   190  ```bash
   191  {% raw %}
   192  $ docker search --format "table {{.Name}}\t{{.IsAutomated}}\t{{.IsOfficial}}" nginx
   193  
   194  NAME                                     AUTOMATED           OFFICIAL
   195  nginx                                                        [OK]
   196  jwilder/nginx-proxy                      [OK]                
   197  richarvey/nginx-php-fpm                  [OK]                
   198  jrcs/letsencrypt-nginx-proxy-companion   [OK]                
   199  million12/nginx-php                      [OK]                
   200  webdevops/php-nginx                      [OK]                
   201  {% endraw %}
   202  ```