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