...

Text file src/github.com/docker/cli/docs/reference/commandline/search.md

Documentation: github.com/docker/cli/docs/reference/commandline

     1# search
     2
     3<!---MARKER_GEN_START-->
     4Search Docker Hub for images
     5
     6### Options
     7
     8| Name                                   | Type     | Default | Description                                |
     9|:---------------------------------------|:---------|:--------|:-------------------------------------------|
    10| [`-f`](#filter), [`--filter`](#filter) | `filter` |         | Filter output based on conditions provided |
    11| [`--format`](#format)                  | `string` |         | Pretty-print search using a Go template    |
    12| [`--limit`](#limit)                    | `int`    | `0`     | Max number of search results               |
    13| [`--no-trunc`](#no-trunc)              |          |         | Don't truncate output                      |
    14
    15
    16<!---MARKER_GEN_END-->
    17
    18## Description
    19
    20Search [Docker Hub](https://hub.docker.com) for images
    21
    22## Examples
    23
    24### Search images by name
    25
    26This example displays images with a name containing 'busybox':
    27
    28```console
    29$ docker search busybox
    30
    31NAME                             DESCRIPTION                                     STARS     OFFICIAL
    32busybox                          Busybox base image.                             316       [OK]
    33progrium/busybox                                                                 50
    34radial/busyboxplus               Full-chain, Internet enabled, busybox made...   8
    35odise/busybox-python                                                             2
    36azukiapp/busybox                 This image is meant to be used as the base...   2
    37ofayau/busybox-jvm               Prepare busybox to install a 32 bits JVM.       1
    38shingonoide/archlinux-busybox    Arch Linux, a lightweight and flexible Lin...   1
    39odise/busybox-curl                                                               1
    40ofayau/busybox-libc32            Busybox with 32 bits (and 64 bits) libs         1
    41peelsky/zulu-openjdk-busybox                                                     1
    42skomma/busybox-data              Docker image suitable for data volume cont...   1
    43elektritter/busybox-teamspeak    Lightweight teamspeak3 container based on...    1
    44socketplane/busybox                                                              1
    45oveits/docker-nginx-busybox      This is a tiny NginX docker image based on...   0
    46ggtools/busybox-ubuntu           Busybox ubuntu version with extra goodies       0
    47nikfoundas/busybox-confd         Minimal busybox based distribution of confd     0
    48openshift/busybox-http-app                                                       0
    49jllopis/busybox                                                                  0
    50swyckoff/busybox                                                                 0
    51powellquiring/busybox                                                            0
    52williamyeh/busybox-sh            Docker image for BusyBox's sh                   0
    53simplexsys/busybox-cli-powered   Docker busybox images, with a few often us...   0
    54fhisamoto/busybox-java           Busybox java                                    0
    55scottabernethy/busybox                                                           0
    56marclop/busybox-solr
    57```
    58
    59### <a name="no-trunc"></a> Display non-truncated description (--no-trunc)
    60
    61This example displays images with a name containing 'busybox',
    62at least 3 stars and the description isn't truncated in the output:
    63
    64```console
    65$ docker search --filter=stars=3 --no-trunc busybox
    66
    67NAME                 DESCRIPTION                                                                               STARS     OFFICIAL
    68busybox              Busybox base image.                                                                       325       [OK]
    69progrium/busybox                                                                                               50
    70radial/busyboxplus   Full-chain, Internet enabled, busybox made from scratch. Comes in git and cURL flavors.   8
    71```
    72
    73### <a name="limit"></a> Limit search results (--limit)
    74
    75The flag `--limit` is the maximum number of results returned by a search. If no
    76value is set, the default is set by the daemon.
    77
    78### <a name="filter"></a> Filtering (--filter)
    79
    80The filtering flag (`-f` or `--filter`) format is a `key=value` pair. If there is more
    81than one filter, then pass multiple flags (e.g. `--filter is-official=true --filter stars=3`).
    82
    83The currently supported filters are:
    84
    85- stars (int - number of stars the image has)
    86- is-automated (boolean - true or false) - is the image automated or not (deprecated)
    87- is-official (boolean - true or false) - is the image official or not
    88
    89#### stars
    90
    91This example displays images with a name containing 'busybox' and at
    92least 3 stars:
    93
    94```console
    95$ docker search --filter stars=3 busybox
    96
    97NAME                 DESCRIPTION                                     STARS     OFFICIAL
    98busybox              Busybox base image.                             325       [OK]
    99progrium/busybox                                                     50
   100radial/busyboxplus   Full-chain, Internet enabled, busybox made...   8
   101```
   102
   103#### is-official
   104
   105This example displays images with a name containing 'busybox', at least
   1063 stars and are official builds:
   107
   108```console
   109$ docker search --filter is-official=true --filter stars=3 busybox
   110
   111NAME      DESCRIPTION           STARS     OFFICIAL
   112busybox   Busybox base image.   325       [OK]
   113```
   114
   115### <a name="format"></a> Format the output (--format)
   116
   117The formatting option (`--format`) pretty-prints search output
   118using a Go template.
   119
   120Valid placeholders for the Go template are:
   121
   122| Placeholder    | Description                                    |
   123|----------------|------------------------------------------------|
   124| `.Name`        | Image Name                                     |
   125| `.Description` | Image description                              |
   126| `.StarCount`   | Number of stars for the image                  |
   127| `.IsOfficial`  | "OK" if image is official                      |
   128| `.IsAutomated` | "OK" if image build was automated (deprecated) |
   129
   130When you use the `--format` option, the `search` command will
   131output the data exactly as the template declares. If you use the
   132`table` directive, column headers are included as well.
   133
   134The following example uses a template without headers and outputs the
   135`Name` and `StarCount` entries separated by a colon (`:`) for all images:
   136
   137```console
   138$ docker search --format "{{.Name}}: {{.StarCount}}" nginx
   139
   140nginx: 5441
   141jwilder/nginx-proxy: 953
   142richarvey/nginx-php-fpm: 353
   143million12/nginx-php: 75
   144webdevops/php-nginx: 70
   145h3nrik/nginx-ldap: 35
   146bitnami/nginx: 23
   147evild/alpine-nginx: 14
   148million12/nginx: 9
   149maxexcloo/nginx: 7
   150```
   151
   152This example outputs a table format:
   153
   154```console
   155$ docker search --format "table {{.Name}}\t{{.IsOfficial}}" nginx
   156
   157NAME                                     OFFICIAL
   158nginx                                    [OK]
   159jwilder/nginx-proxy
   160richarvey/nginx-php-fpm
   161jrcs/letsencrypt-nginx-proxy-companion
   162million12/nginx-php
   163webdevops/php-nginx
   164```

View as plain text